1
0
mirror of https://github.com/golang/go synced 2024-11-17 00:14:50 -07:00

go/internal/gcimporter: call Complete on cloned Interfaces too

For "type T interface{ M() }", go/types users expect T's underlying
interface type to specify T as the receiver parameter type (#49906).
The unified importer handles this by cloning the interface to rewrite
the receiver parameters before calling SetUnderlying.

I missed in CL 425360 that these interfaces would need to have
Complete called too.

Manually tested to confirm that this actually fixes "go test -race
golang.org/x/tools/go/analysis/internal/checker" now (when both CLs
are ported to the x/tools importer).

Updates #54653.

Change-Id: I51e6db925db56947cd39dbe880230f14734ca01c
Reviewed-on: https://go-review.googlesource.com/c/go/+/425365
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
This commit is contained in:
Matthew Dempsky 2022-08-24 13:47:48 -07:00
parent bdf2db7255
commit e4bed415ea

View File

@ -539,7 +539,9 @@ func (pr *pkgReader) objIdx(idx pkgbits.Index) (*types.Package, string) {
embeds[i] = iface.EmbeddedType(i)
}
underlying = types.NewInterfaceType(methods, embeds)
newIface := types.NewInterfaceType(methods, embeds)
r.p.ifaces = append(r.p.ifaces, newIface)
underlying = newIface
}
named.SetUnderlying(underlying)