From: Matthew Dempsky Date: Wed, 24 Aug 2022 20:47:48 +0000 (-0700) Subject: go/internal/gcimporter: call Complete on cloned Interfaces too X-Git-Tag: go1.20rc1~1421 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=e4bed415ead32ece0acb396f025d3338fab5029d;p=gostls13.git 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 Run-TryBot: Matthew Dempsky Reviewed-by: Robert Griesemer --- diff --git a/src/go/internal/gcimporter/ureader.go b/src/go/internal/gcimporter/ureader.go index 15c8c2032d..53bb9bacb0 100644 --- a/src/go/internal/gcimporter/ureader.go +++ b/src/go/internal/gcimporter/ureader.go @@ -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)