spec: add duplicate nil to the implementation restriction for switches #28378
For what it's worth, cmd/compile only warns about duplicate nils for switches on non-interface expressions. That is, it doesn't warn about duplicate nil for switches on interface expressions or at all in map literals.
I'm working on a CL to unify this code. My inclination is to just stop warning about duplicate nils, rather than relax the spec to allow this. We don't even report them correctly, so I doubt anyone's triggering this in practice:
Consistent logic for handling both duplicate map keys and case values, and eliminates ad hoc value hashing code. Also makes cmd/compile consistent with go/types's handling of duplicate constants (see #28085), which is at least an improvement over the status quo even if we settle on something different for the spec. As a side effect, this also suppresses cmd/compile's warnings about duplicate nils in (non-interface expression) switch statements, which was technically never allowed by the spec anyway. Updates #28085. Updates #28378. Change-Id: I176a251e770c3c5bc11c2bf8d1d862db8f252a17 Reviewed-on: https://go-review.googlesource.com/c/152544 Run-TryBot: Matthew Dempsky <firstname.lastname@example.org> TryBot-Result: Gobot Gobot <email@example.com> Reviewed-by: Robert Griesemer <firstname.lastname@example.org>