[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:
Dan Scales 2021-06-28 11:50:26 -07:00
parent f99b3fe2ab
commit 64e6c75924
4 changed files with 17 additions and 6 deletions

View file

@ -329,8 +329,20 @@ assignOK:
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
}