compiler: fix a few crashes due to named types

There were a few cases left where a named type would cause a crash in
the compiler. While going through enough code would have found them
eventually, I specifically looked for the `Type().(` pattern: a Type()
call that is then used in a type assert. Most of those were indeed bugs,
although for some I couldn't come up with a reproducer so I left them
as-is.
This commit is contained in:
Ayke van Laethem
2020-05-27 00:17:28 +02:00
committed by Ron Evans
parent 4ca2d3f0cf
commit c248418dbe
5 changed files with 35 additions and 7 deletions
+12
View File
@@ -68,6 +68,8 @@ func main() {
m.Unlock()
println("done")
startSimpleFunc(emptyFunc)
time.Sleep(2 * time.Millisecond)
}
@@ -100,6 +102,11 @@ func sleepFuncValue(fn func(int)) {
go fn(8)
}
func startSimpleFunc(fn simpleFunc) {
// Test that named function types don't crash the compiler.
go fn()
}
func nowait() {
println("non-blocking goroutine")
}
@@ -115,3 +122,8 @@ func (i *myPrinter) Print() {
time.Sleep(time.Millisecond)
println("async interface method call")
}
type simpleFunc func()
func emptyFunc() {
}