mirror of
https://github.com/golang/go.git
synced 2026-04-02 01:10:27 +09:00
[dev.typeparams] cmd/compile: add CONVIFACE nodes for return values during noder2
Even if we can otherwise transform a return statement because of type params, add CONVIFACE nodes where appropriate. Change-Id: Ia2216d5f6805926075ba6802a4385eee1d63e37e Reviewed-on: https://go-review.googlesource.com/c/go/+/337049 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>
This commit is contained in:
@@ -128,6 +128,11 @@ func (g *irgen) stmt(stmt syntax.Stmt) ir.Node {
|
||||
if e.Type().HasTParam() {
|
||||
// Delay transforming the return statement if any of the
|
||||
// return values have a type param.
|
||||
if !ir.HasNamedResults(ir.CurFunc) {
|
||||
// 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)
|
||||
}
|
||||
n.SetTypecheck(3)
|
||||
return n
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user