You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
package main
const x = 42
func main() {
switch x := interface{}(nil).(type) {
default:
_ = x
}
}
with the error message:
prog.go:6: invalid variable name x in type switch
The text was updated successfully, but these errors were encountered:
ianlancetaylor
changed the title
go/gc: "invalid variable name x in type switch", where x is a name of a constant
cmd/compile: "invalid variable name x in type switch", where x is a name of a constant
Aug 31, 2015
Have an idea with what is wrong: Looks like x in the type switch grabs the const x symbol during parsing, which gives it the OLITERAL op that then errors in the type switch. Looking into a fix.
The following program fails to build (http://play.golang.org/p/qrVKDN_MDR):
with the error message:
The text was updated successfully, but these errors were encountered: