cmd/compile: look for function in instantiations in all global assignments

Add in some missing global assignment ops to the list of globals ops
that should be traversed to look for generic function instantiations.
The most common other one for global assigments (and the relevant one
for this bug) is OAS2FUNC, but also look at global assigments with
OAS2DOTTYPE, OAS2MAPR, OAS2RECV, and OASOP.

Bonus small fix: get rid of -G=3 case in ir.IsAddressable. Now that we
don't call the old typechecker from noder2, we don't need this -G-3
check anymore.

Fixes #45547.

Change-Id: I75fecec55ea0d6f62e1c2294d4d77447ed9be6ae
Reviewed-on: https://go-review.googlesource.com/c/go/+/310210
Trust: Dan Scales <danscales@google.com>
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Dan Scales <danscales@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
This commit is contained in:
Dan Scales 2021-04-14 14:54:14 -07:00
parent 567a9322ad
commit bf634c76b2
3 changed files with 27 additions and 10 deletions

View file

@ -748,13 +748,6 @@ func IsAddressable(n Node) bool {
case ODEREF, ODOTPTR:
return true
case OXDOT:
// TODO(danscales): remove this case as we remove calls to the old
// typechecker in (*irgen).funcBody().
if base.Flag.G == 0 {
return false
}
fallthrough
case ODOT:
n := n.(*SelectorExpr)
return IsAddressable(n.X)