mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00: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:
parent
02c0172500
commit
e6d956e1c5
1 changed files with 5 additions and 0 deletions
|
|
@ -128,6 +128,11 @@ func (g *irgen) stmt(stmt syntax.Stmt) ir.Node {
|
||||||
if e.Type().HasTParam() {
|
if e.Type().HasTParam() {
|
||||||
// Delay transforming the return statement if any of the
|
// Delay transforming the return statement if any of the
|
||||||
// return values have a type param.
|
// 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)
|
n.SetTypecheck(3)
|
||||||
return n
|
return n
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue