8c85e23 caused a regression where duplicate cases fail to be detected in a switch.
package main
func main() {
var a int
switch a {
case 0,1:
case 0:
}
}
On Go1.7, the above program fails:
./main.go:13: duplicate case 0 in switch
previous case at ./main.go:12
On Go1.8dev, the above program, unexpectedly succeeds.
I understand that this is not a language guarantee:
Implementation restriction: A compiler may disallow multiple case expressions evaluating to the same constant. For instance, the current compilers disallow duplicate integer, floating point, or string constants in case expressions.
However, we should be consistent with how it is done. The following snippet is rejected on both Go1.7 and Go1.8dev:
var a int
switch a {
case 0:
case 0:
}
/cc @josharian @mdempsky
8c85e23 caused a regression where duplicate cases fail to be detected in a switch.
On Go1.7, the above program fails:
On Go1.8dev, the above program, unexpectedly succeeds.
I understand that this is not a language guarantee:
However, we should be consistent with how it is done. The following snippet is rejected on both Go1.7 and Go1.8dev:
/cc @josharian @mdempsky