]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: ignore receiver name when checking duplicate methods
authorMatthew Dempsky <mdempsky@google.com>
Sun, 20 Mar 2016 00:51:17 +0000 (17:51 -0700)
committerMatthew Dempsky <mdempsky@google.com>
Sun, 20 Mar 2016 04:37:04 +0000 (04:37 +0000)
commit3eaa3046295b9a5bdff0428060c5ffd46347651a
tree6b821a76fc5b05007b5a0c78cc2a6c2a3f9aae05
parentec7c49453516957280ab8756c5dcd45f7cc11efe
cmd/compile: ignore receiver name when checking duplicate methods

In golang.org/cl/20602, I changed the semantics of Eqtype to stop
checking the receiver parameters for type equality, and pushed this
responsibility to addmethod (the only Eqtype caller that cared).
However, I accidentally made the check stricter by making it start
requiring that receiver names were identical.

In general, this is a non-problem because the receiver names in export
data will always match the original source. But running
GO_GCFLAGS=-newexport ./all.bash at one point tries to load both old
and new format export data for package sync, which reveals the
problem. (See golang.org/issue/14877 for details.)

Easy fix: just check the receiver type for type equality in addmethod,
instead of the entire receiver parameter list.

Fixes #14877.

Change-Id: If10b79f66ba58a1b7774622b4fbad1916aba32f1
Reviewed-on: https://go-review.googlesource.com/20906
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/cmd/compile/internal/gc/dcl.go