]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: unify duplicate const detection logic
authorMatthew Dempsky <mdempsky@google.com>
Tue, 4 Dec 2018 23:11:03 +0000 (15:11 -0800)
committerMatthew Dempsky <mdempsky@google.com>
Wed, 27 Feb 2019 01:08:13 +0000 (01:08 +0000)
commit6fa7669fd7d9994ef20e40f41a9771d664d00c5e
tree4e6798131acda6a4c952af9070c484c78bb1ffc7
parente5fb1c6d7ad0f7308d520b18d745e130b32af083
cmd/compile: unify duplicate const detection logic

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 <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
src/cmd/compile/internal/gc/const.go
src/cmd/compile/internal/gc/swt.go
src/cmd/compile/internal/gc/typecheck.go
test/fixedbugs/issue28085.go [new file with mode: 0644]