]> Cypherpunks repositories - gostls13.git/commit
[release-branch.go1.11] go/types: use correct receiver types for embedded interface...
authorRobert Griesemer <gri@golang.org>
Thu, 11 Oct 2018 00:19:29 +0000 (17:19 -0700)
committerBrad Fitzpatrick <bradfitz@golang.org>
Thu, 1 Nov 2018 18:51:57 +0000 (18:51 +0000)
commit68ad1d60a27f7a1fff2ed34e2c3476c77bcd3a6d
treebac24232e47d79c2508e45c49f86b9ea05f19c48
parent369c188667420762ff498e36f3a82b159d15f70d
[release-branch.go1.11] go/types: use correct receiver types for embedded interface methods

Interface methods don't declare a receiver (it's implicit), but after
type-checking the respective *types.Func objects are marked as methods
by having a receiver. For interface methods, the receiver base type used
to be the interface that declared the method in the first place, even if
the method also appeared in other interfaces via embedding. A change in
the computation of method sets for interfaces for Go1.10 changed that
inadvertently, with the consequence that sometimes a method's receiver
type ended up being an interface into which the method was embedded.
The exact behavior also depended on file type-checking order, and because
files are sometimes sorted by name, the behavior depended on file names.

This didn't matter for type-checking (the typechecker doesn't need the
receiver), but it matters for clients, and for printing of methods.

This change fixes interface method receivers at the end of type-checking
when we have all relevant information.

Fixes #28249
Updates #28005

Change-Id: I96c120fb0e517d7f8a14b8530f0273674569d5ea
Reviewed-on: https://go-review.googlesource.com/c/141358
Reviewed-by: Alan Donovan <adonovan@google.com>
Reviewed-on: https://go-review.googlesource.com/c/146660
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
src/go/types/issues_test.go
src/go/types/typexpr.go