mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
[dev.typeparams] cmd/compile: port fix for issue46725 to transform.go
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>
This commit is contained in:
parent
f99b3fe2ab
commit
64e6c75924
4 changed files with 17 additions and 6 deletions
|
|
@ -329,8 +329,20 @@ assignOK:
|
||||||
r.Use = ir.CallUseList
|
r.Use = ir.CallUseList
|
||||||
rtyp := r.Type()
|
rtyp := r.Type()
|
||||||
|
|
||||||
|
mismatched := false
|
||||||
|
failed := false
|
||||||
for i := range lhs {
|
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
|
return
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -217,7 +217,7 @@ assignOK:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if mismatched && !failed {
|
if mismatched && !failed {
|
||||||
rewriteMultiValueCall(stmt, r)
|
RewriteMultiValueCall(stmt, r)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -962,12 +962,12 @@ func typecheckargs(n ir.InitNode) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Rewrite f(g()) into t1, t2, ... = g(); f(t1, t2, ...).
|
// 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.
|
// 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
|
// If we're outside of function context, then this call will
|
||||||
// be executed during the generated init function. However,
|
// be executed during the generated init function. However,
|
||||||
// init.go hasn't yet created it. Instead, associate the
|
// init.go hasn't yet created it. Instead, associate the
|
||||||
|
|
|
||||||
|
|
@ -2131,7 +2131,6 @@ var excludedFiles = map[string]bool{
|
||||||
"fixedbugs/issue4232.go": true, // types2 reports (correct) extra errors
|
"fixedbugs/issue4232.go": true, // types2 reports (correct) extra errors
|
||||||
"fixedbugs/issue4452.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/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/issue5609.go": true, // types2 needs a better error message
|
||||||
"fixedbugs/issue7525b.go": true, // types2 reports init cycle error on different line - ok otherwise
|
"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
|
"fixedbugs/issue7525c.go": true, // types2 reports init cycle error on different line - ok otherwise
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue