Commit 5b071bfa authored by Michael Fraenkel's avatar Michael Fraenkel Committed by Matthew Dempsky

cmd/compile: convert type during finishcompare

When recursively calling walkexpr, r.Type is still the untyped value.
It then sometimes recursively calls finishcompare, which complains that
you can't compare the resulting expression to that untyped value.

Updates #23834.

Change-Id: I6b7acd3970ceaff8da9216bfa0ae24aca5dee828
Reviewed-on: https://go-review.googlesource.com/97856Reviewed-by: 's avatarMatthew Dempsky <mdempsky@google.com>
parent 9b95611e
......@@ -3455,12 +3455,8 @@ func walkcompare(n *Node, init *Nodes) *Node {
// n.Left = finishcompare(n.Left, x, r, init)
func finishcompare(n, r *Node, init *Nodes) *Node {
r = typecheck(r, Erv)
r = conv(r, n.Type)
r = walkexpr(r, init)
if r.Type != n.Type {
r = nod(OCONVNOP, r, nil)
r.Type = n.Type
r = typecheck(r, Erv)
}
return r
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment