]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: convert type during finishcompare
authorMichael Fraenkel <michael.fraenkel@gmail.com>
Thu, 1 Mar 2018 14:26:38 +0000 (09:26 -0500)
committerMatthew Dempsky <mdempsky@google.com>
Fri, 2 Mar 2018 19:48:23 +0000 (19:48 +0000)
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/97856
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
src/cmd/compile/internal/gc/walk.go

index ab113daec41cfb605d176582dd6e27814ead48ee..f1ef2341eece9dc6ef9f45379a345f653c51f5a1 100644 (file)
@@ -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
 }