]> Cypherpunks repositories - gostls13.git/commit
[dev.typeparams] cmd/compile: slightly more incremental unified typecheck
authorMatthew Dempsky <mdempsky@google.com>
Sat, 10 Jul 2021 02:47:45 +0000 (19:47 -0700)
committerMatthew Dempsky <mdempsky@google.com>
Sun, 11 Jul 2021 17:21:28 +0000 (17:21 +0000)
commit0dcab98fd829e845a83fed996025f96b8b1165b1
tree4fac8c93850a741a917bb0b87067f2b73ff3c815
parent3c3c1d8d2856e7859f4ba36b19c91f1538546d2a
[dev.typeparams] cmd/compile: slightly more incremental unified typecheck

This CL pushes the typecheck.Expr calls further down to the IR
construction points. It turns out we don't really care about
typecheck.AssignExpr, because it's only used to distinguish whether
ir.BlankNode is allowed. We can avoid that issue by just skipping the
call to typecheck.Expr for blank nodes.

Similarly, for typecheck.Callee, only two details matter: (1) don't
report errors for builtin functions (which aren't allowed outside of
callee contexts); and (2) method-value selector expressions need to
have Op ODOTMETH/ODOTINTER rather than OMETHVALUE. The first can be
handled by simply skipping typecheck on Names (as with ir.BlankNode,
we don't need to typecheck these). The second currently requires
adding a 'callee bool' parameter to disambiguate the context.

The other option would be for exprCall to reset the fun's Op from
OMETHVALUE to OXDOT and let typecheck handle it a second time. But I
anticipate needing to add extra logic in the exprSelector case which
would be harder to undo, so this seems somewhat better.

Change-Id: I1a8dfb6af04265ab466fd7f4cb6ee8b479e92282
Reviewed-on: https://go-review.googlesource.com/c/go/+/333769
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Trust: Matthew Dempsky <mdempsky@google.com>
src/cmd/compile/internal/noder/reader.go
src/cmd/compile/internal/noder/writer.go