diff options
author | Matthew Dempsky <mdempsky@google.com> | 2021-06-11 02:44:16 -0700 |
---|---|---|
committer | Matthew Dempsky <mdempsky@google.com> | 2021-06-11 17:18:40 +0000 |
commit | ef6c5be16025a1868fc27267b7abfb1c28329fe2 (patch) | |
tree | cec09ae54978a014539a50a27f3e4e4ed16f7871 /src/cmd/compile/internal/reflectdata/reflect.go | |
parent | 4a735ce0680e5ea6088da8072ba4c2b0076e51cb (diff) | |
download | go-ef6c5be16025a1868fc27267b7abfb1c28329fe2.tar.gz go-ef6c5be16025a1868fc27267b7abfb1c28329fe2.zip |
[dev.typeparams] cmd/compile: fix wrapper generation for imported generics
This CL fixes reflectdata.methodWrapper to compile wrapper functions
for method expressions involving imported, instantiated interface
types. CL 322193 fixed a similar issue for generating wrappers for
imported, instantiated concrete types, but missed this case.
This is necessary to fix CL 326169's test case 10. However, that test
case is not included currently, because -G=3 mode crashes on method
expressions involving *any* instantiated interface type. Adding a test
will have to wait until either this issue is fixed in -G=3 mode, or
unified IR is merged.
Updates #46704.
Change-Id: Ib02d3c20e7c69d16288f1286cd1c98e7cbbba114
Reviewed-on: https://go-review.googlesource.com/c/go/+/327055
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Dan Scales <danscales@google.com>
Trust: Dan Scales <danscales@google.com>
Trust: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Diffstat (limited to 'src/cmd/compile/internal/reflectdata/reflect.go')
-rw-r--r-- | src/cmd/compile/internal/reflectdata/reflect.go | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/cmd/compile/internal/reflectdata/reflect.go b/src/cmd/compile/internal/reflectdata/reflect.go index 0fcb7e3d6d..bdc3527011 100644 --- a/src/cmd/compile/internal/reflectdata/reflect.go +++ b/src/cmd/compile/internal/reflectdata/reflect.go @@ -1800,8 +1800,11 @@ func methodWrapper(rcvr *types.Type, method *types.Field, forItab bool) *obj.LSy } // Only generate I.M wrappers for I in I's own package - // but keep doing it for error.Error (was issue #29304). - if rcvr.IsInterface() && rcvr.Sym() != nil && rcvr.Sym().Pkg != types.LocalPkg && rcvr != types.ErrorType { + // but keep doing it for error.Error (was issue #29304) + // and methods of instantiated interfaces. + if rcvr.IsInterface() && rcvr != types.ErrorType && + rcvr.Sym() != nil && rcvr.Sym().Pkg != types.LocalPkg && + !rcvr.IsFullyInstantiated() { return lsym } |