spec: clarify requirements for duplicate constants in interface-typed map literal keys and switches #28085
Labels
Documentation
Issues describing a change to documentation.
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
The Go spec disallows duplicate constants in map literal keys, and allows compilers to reject duplicate constants in switch cases.
However, the Go spec does not formally allow interface-typed constants, and doesn't mention how to handle constants that are implicitly or explicitly converted to interface type. The existing compilers handle these situations in differing ways:
cmd/compile rejects 1, 2, and 3.
go/types rejects 1 and 3.
gccgo (8.0) rejects none.
/cc @griesemer @ianlancetaylor
The text was updated successfully, but these errors were encountered: