diff options
author | Matthew Dempsky <mdempsky@google.com> | 2022-08-03 16:13:56 -0700 |
---|---|---|
committer | Gopher Robot <gobot@golang.org> | 2022-08-04 18:27:30 +0000 |
commit | 39728f412d5fb6d97568cc84a42f1caf07dbaedc (patch) | |
tree | 834ac5153aedb1a5c5b5546f23ea932befdb0cfe /src/go/internal/gcimporter/gcimporter_test.go | |
parent | a10afb15e060386615dcc0ecf2bd60ca3abbc04c (diff) | |
download | go-git-39728f412d5fb6d97568cc84a42f1caf07dbaedc.tar.gz |
go/internal/gcimporter: rewrite interface receiver parameters
For a type definition like `type I interface{ M() }`, the go/types API
traditionally sets `M`'s receiver parameter type to `I`, whereas
Unified IR was (intentionally) leaving it as `interface{ M() }`.
I still think `interface{ M() }` is the more consistent and
semantically correct type to use in this scenario, but I concede that
users want `I` instead, as evidenced by existing tooling and tests.
Updates #49906.
Change-Id: I74ba5e8b08e4e98ed9dc49f72b7834d5b552058b
Reviewed-on: https://go-review.googlesource.com/c/go/+/421355
Reviewed-by: David Chase <drchase@google.com>
Auto-Submit: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Diffstat (limited to 'src/go/internal/gcimporter/gcimporter_test.go')
-rw-r--r-- | src/go/internal/gcimporter/gcimporter_test.go | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/src/go/internal/gcimporter/gcimporter_test.go b/src/go/internal/gcimporter/gcimporter_test.go index 68a077c190..dd41c2550c 100644 --- a/src/go/internal/gcimporter/gcimporter_test.go +++ b/src/go/internal/gcimporter/gcimporter_test.go @@ -461,14 +461,6 @@ func verifyInterfaceMethodRecvs(t *testing.T, named *types.Named, level int) { return // not an interface } - // The unified IR importer always sets interface method receiver - // parameters to point to the Interface type, rather than the Named. - // See #49906. - var want types.Type = named - if goexperiment.Unified { - want = iface - } - // check explicitly declared methods for i := 0; i < iface.NumExplicitMethods(); i++ { m := iface.ExplicitMethod(i) @@ -477,8 +469,8 @@ func verifyInterfaceMethodRecvs(t *testing.T, named *types.Named, level int) { t.Errorf("%s: missing receiver type", m) continue } - if recv.Type() != want { - t.Errorf("%s: got recv type %s; want %s", m, recv.Type(), want) + if recv.Type() != named { + t.Errorf("%s: got recv type %s; want %s", m, recv.Type(), named) } } |