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
+11
View File
@@ -8,6 +8,8 @@ import (
var wg sync.WaitGroup
type intchan chan int
func main() {
ch := make(chan int, 2)
ch <- 1
@@ -40,6 +42,15 @@ func main() {
_ = make(chan int, uint32(2))
_ = make(chan int, uint64(2))
// Test that named channels don't crash the compiler.
named := make(intchan, 1)
named <- 3
<-named
select {
case <-named:
default:
}
// Test bigger values
ch2 := make(chan complex128)
wg.Add(1)