diff options
author | Dan Scales <danscales@google.com> | 2021-08-22 13:34:22 -0700 |
---|---|---|
committer | Dan Scales <danscales@google.com> | 2021-08-23 16:57:27 +0000 |
commit | f457ecc7f096c7e6b225003b583b989384ef0fcb (patch) | |
tree | 5462a743116a6264ae55e5b64b63ed71c2a987b5 /src/cmd/compile/internal/noder/decl.go | |
parent | f1d8ea1da3ef814ea57b545fc967865640a868ab (diff) | |
download | go-f457ecc7f096c7e6b225003b583b989384ef0fcb.tar.gz go-f457ecc7f096c7e6b225003b583b989384ef0fcb.zip |
cmd/compile: fixing 15.go for -G=3
Required two changes:
- avoid creating a closure in the case where the actual receiver of an
embedded method is not generic even though the base operand of the
selector is generic. This is similar to the test suggested by wayne
zuo - I thought it was clear in buildClosure, and easier to comment.
- Propagate //go:nointerface to base generic methods and then to
instantiations.
Change-Id: If30c834e4223c2639b7f7e74d44e6087aa9ccd76
Reviewed-on: https://go-review.googlesource.com/c/go/+/344251
Run-TryBot: Dan Scales <danscales@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Wayne Zuo <wdvxdr1123@gmail.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Trust: Dan Scales <danscales@google.com>
Diffstat (limited to 'src/cmd/compile/internal/noder/decl.go')
-rw-r--r-- | src/cmd/compile/internal/noder/decl.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/cmd/compile/internal/noder/decl.go b/src/cmd/compile/internal/noder/decl.go index cec31d87b7..6b55ce1453 100644 --- a/src/cmd/compile/internal/noder/decl.go +++ b/src/cmd/compile/internal/noder/decl.go @@ -104,6 +104,12 @@ func (g *irgen) funcDecl(out *ir.Nodes, decl *syntax.FuncDecl) { // the Fields to represent the receiver's method set. if recv := fn.Type().Recv(); recv != nil { typ := types.ReceiverBaseType(recv.Type) + if typ.OrigSym != nil { + // For a generic method, we mark the methods on the + // base generic type, since those are the methods + // that will be stenciled. + typ = typ.OrigSym.Def.Type() + } meth := typecheck.Lookdot1(fn, typecheck.Lookup(decl.Name.Value), typ, typ.Methods(), 0) meth.SetNointerface(true) } |