[dev.typeparams] cmd/compile: fix unified IR support for //go:nointerface

This CL changes fixedbugs/issue30862.go into a "runindir" test so that
it can use '-goexperiment fieldtrack' and test that //go:nointerface
works with cmd/compile. In particular, this revealed that -G=3 and
unified IR did not handle it correctly.

This CL also fixes unified IR's support for //go:nointerface and adds
a test that checks that //go:nointerface, promoted methods, and
generics all interact as expected.

Updates #47045.

Change-Id: Ib8acff8ae18bf124520d00c98e8915699cba2abd
Reviewed-on: https://go-review.googlesource.com/c/go/+/332611
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
This commit is contained in:
Matthew Dempsky 2021-07-02 16:59:01 -07:00
parent b27c7e30dc
commit bfcb7c4c8a
7 changed files with 78 additions and 10 deletions

View file

@ -750,13 +750,12 @@ func (r *reader) method() *types.Field {
name.Func = ir.NewFunc(r.pos())
name.Func.Nname = name
// TODO(mdempsky): Make sure we're handling //go:nointerface
// correctly. I don't think this is exercised within the Go repo.
r.ext.funcExt(name)
meth := types.NewField(name.Func.Pos(), sym, typ)
meth.Nname = name
meth.SetNointerface(name.Func.Pragma&ir.Nointerface != 0)
return meth
}