]> Cypherpunks repositories - gostls13.git/commitdiff
go/types: fix regression in type checking of RangeStmt.
authorAlan Donovan <adonovan@google.com>
Fri, 1 Mar 2013 01:37:25 +0000 (20:37 -0500)
committerAlan Donovan <adonovan@google.com>
Fri, 1 Mar 2013 01:37:25 +0000 (20:37 -0500)
Now that untyped expressions are done in two phases, the
identity of operand.expr is used as a map key; when reusing
operand values we now must be careful to update the
expr field.

R=gri
CC=golang-dev
https://golang.org/cl/7444049

src/pkg/go/types/stmt.go

index 24a47901f801d20e487349cb0a7b96153c0135c9..f4c158da91fa7358b21965cb2781b3914a7a23b6 100644 (file)
@@ -719,6 +719,7 @@ func (check *checker) stmt(s ast.Stmt) {
                x.mode = value
                if s.Key != nil {
                        x.typ = key
+                       x.expr = s.Key
                        check.assign1to1(s.Key, nil, &x, decl, -1)
                } else {
                        check.invalidAST(s.Pos(), "range clause requires index iteration variable")
@@ -726,6 +727,7 @@ func (check *checker) stmt(s ast.Stmt) {
                }
                if s.Value != nil {
                        x.typ = val
+                       x.expr = s.Value
                        check.assign1to1(s.Value, nil, &x, decl, -1)
                }