Allow fix for issue46725 to work for -G=3 mode.
Change-Id: Id522fbc2278cf878cb3f95b3205a2122c164ae29
Reviewed-on: https://go-review.googlesource.com/c/go/+/331470
Trust: Dan Scales <danscales@google.com>
Run-TryBot: Dan Scales <danscales@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
r.Use = ir.CallUseList
rtyp := r.Type()
+ mismatched := false
+ failed := false
for i := range lhs {
- checkLHS(i, rtyp.Field(i).Type)
+ result := rtyp.Field(i).Type
+ checkLHS(i, result)
+
+ if lhs[i].Type() == nil || result == nil {
+ failed = true
+ } else if lhs[i] != ir.BlankNode && !types.Identical(lhs[i].Type(), result) {
+ mismatched = true
+ }
+ }
+ if mismatched && !failed {
+ typecheck.RewriteMultiValueCall(stmt, r)
}
return
}
}
}
if mismatched && !failed {
- rewriteMultiValueCall(stmt, r)
+ RewriteMultiValueCall(stmt, r)
}
return
}
}
// Rewrite f(g()) into t1, t2, ... = g(); f(t1, t2, ...).
- rewriteMultiValueCall(n, list[0])
+ RewriteMultiValueCall(n, list[0])
}
-// rewriteMultiValueCall rewrites multi-valued f() to use temporaries,
+// RewriteMultiValueCall rewrites multi-valued f() to use temporaries,
// so the backend wouldn't need to worry about tuple-valued expressions.
-func rewriteMultiValueCall(n ir.InitNode, call ir.Node) {
+func RewriteMultiValueCall(n ir.InitNode, call ir.Node) {
// If we're outside of function context, then this call will
// be executed during the generated init function. However,
// init.go hasn't yet created it. Instead, associate the
"fixedbugs/issue4232.go": true, // types2 reports (correct) extra errors
"fixedbugs/issue4452.go": true, // types2 reports (correct) extra errors
"fixedbugs/issue4510.go": true, // types2 reports different (but ok) line numbers
- "fixedbugs/issue46725.go": true, // fix applied to typecheck needs to be ported to irgen/transform
"fixedbugs/issue5609.go": true, // types2 needs a better error message
"fixedbugs/issue7525b.go": true, // types2 reports init cycle error on different line - ok otherwise
"fixedbugs/issue7525c.go": true, // types2 reports init cycle error on different line - ok otherwise