Closed
Description
This code is spec compliant:
package p
type A int
const X A = 0
func f() {
type A int
const Y A = 0
switch interface{}(nil) {
case X:
case Y:
}
}
go/types and gccgo accept it, but cmd/compile erroneously rejects it with:
a.go:12:2: duplicate case Y (value 0) in switch
previous case at a.go:4:13
The issue is swt.go:632 is using typeVal to look for value collisions. However, it's using the string representation of types to look for type identity, but this isn't sound as the example above demonstrates.