diff options
author | Dan Scales <danscales@google.com> | 2021-08-06 13:24:14 -0700 |
---|---|---|
committer | Dan Scales <danscales@google.com> | 2021-08-09 19:43:09 +0000 |
commit | 9f4d6a83594a04f0fc82c33f373b7e7bcf64f7f2 (patch) | |
tree | bf60a5655f608dbb238f6e1803ad0adf9221d271 /src/cmd/compile/internal/noder/stmt.go | |
parent | ca3c6985cd143f170699d22ed984b7eed0f68e4d (diff) | |
download | go-9f4d6a83594a04f0fc82c33f373b7e7bcf64f7f2.tar.gz go-9f4d6a83594a04f0fc82c33f373b7e7bcf64f7f2.zip |
[dev.typeparams] cmd/compile: call transformArgs before early typecheckaste in noder
In the cases where we do an early call to typecheckaste() in noder to
expose CONVIFACE nodes, we need a preceding call to transformArgs().
This is needed to allow typecheckaste() to run correctly, in the case of
f(g()), where g has multiple return values.
I also cleaned up the code a bit and commented the code in Call(), and
we do the call to typecheckaste() in several more cases.
In stencil.go:stencil(), I moved the transformCall earlier for the
OCALLMETH/ODOTMETH case, just as I did in my previous CL for
OCALL/OFUNCINST. By doing this, transformArgs no longer needs to deal
with the extra dictionary args. Therefore, I was able to simply
transformArgs() to look like typecheckargs() again, and make use of
RewriteMultiValue directly.
Updates #47514
Change-Id: I49eb82ac05707e50c2e2fb03e39458a70491d406
Reviewed-on: https://go-review.googlesource.com/c/go/+/340531
Trust: Dan Scales <danscales@google.com>
Run-TryBot: Dan Scales <danscales@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Diffstat (limited to 'src/cmd/compile/internal/noder/stmt.go')
-rw-r--r-- | src/cmd/compile/internal/noder/stmt.go | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/cmd/compile/internal/noder/stmt.go b/src/cmd/compile/internal/noder/stmt.go index 5af4a2da9c..1949f56095 100644 --- a/src/cmd/compile/internal/noder/stmt.go +++ b/src/cmd/compile/internal/noder/stmt.go @@ -129,6 +129,7 @@ func (g *irgen) stmt(stmt syntax.Stmt) ir.Node { // Delay transforming the return statement if any of the // return values have a type param. if !ir.HasNamedResults(ir.CurFunc) { + transformArgs(n) // But add CONVIFACE nodes where needed if // any of the return values have interface type. typecheckaste(ir.ORETURN, nil, false, ir.CurFunc.Type().Results(), n.Results, true) |