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
No compile-time error. At line 7 x (which has been reassigned) has the type map[interface{}]interface{}. If I change the name of the first variable to y, the program compiles:
A compiler error: invalid operation: x[0] (type interface {} does not support indexing)
The text was updated successfully, but these errors were encountered:
ghost
changed the title
cmd/go: thinks reassigned variable is of the previous type
cmd/go: thinks a reassigned variable is of the previous type
Oct 1, 2020
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
https://play.golang.org/p/tWmhlKw98EN
What did you expect to see?
No compile-time error. At line 7
x
(which has been reassigned) has the typemap[interface{}]interface{}
. If I change the name of the first variable toy
, the program compiles:https://play.golang.org/p/5gBNPVXN5os
What did you see instead?
A compiler error:
invalid operation: x[0] (type interface {} does not support indexing)
The text was updated successfully, but these errors were encountered: