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>
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
}