[dev.typeparams] cmd/compile: disambiguate OXDOT in noder using types2 Selection info

By using the types2 Selection information, we can create ODOT, ODOTPTR,
OCALLPART, ODOTMETH, ODOTINTER, and OMETHEXPR nodes directly in noder,
so we don't have to do that functionality in typecheck.go. Intermediate
nodes are created as needed for embedded fields. Don't have to typecheck
the results of g.selectorExpr(), because we set the types of all the
needed nodes.

There is one bug remaining in 'go test reflect' that will be fixed when dev.regabi is merged.

Change-Id: I4599d43197783e318610deb2f208137f9344ab63
Reviewed-on: https://go-review.googlesource.com/c/go/+/285373
Run-TryBot: Dan Scales <danscales@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Dan Scales <danscales@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
Dan Scales 2021-01-19 13:54:33 -08:00
parent f8654579cd
commit 12cd9cf7e0
5 changed files with 136 additions and 42 deletions

View file

@ -79,9 +79,7 @@ func Call(pos src.XPos, fun ir.Node, args []ir.Node, dots bool) ir.Node {
}
}
// We probably already typechecked fun, and typecheck probably
// got it wrong because it didn't know the expression was
// going to be called immediately. Correct its mistakes.
// Add information, now that we know that fun is actually being called.
switch fun := fun.(type) {
case *ir.ClosureExpr:
fun.Func.SetClosureCalled(true)
@ -92,6 +90,8 @@ func Call(pos src.XPos, fun ir.Node, args []ir.Node, dots bool) ir.Node {
op = ir.ODOTINTER
}
fun.SetOp(op)
// Set the type to include the receiver, since that's what
// later parts of the compiler expect
fun.SetType(fun.Selection.Type)
}
}