From: Alan Donovan Date: Fri, 1 Mar 2013 01:37:25 +0000 (-0500) Subject: go/types: fix regression in type checking of RangeStmt. X-Git-Tag: go1.1rc2~759 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=abbbb4283a60df46abe11b898345bbe9bc724034;p=gostls13.git go/types: fix regression in type checking of RangeStmt. 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 --- diff --git a/src/pkg/go/types/stmt.go b/src/pkg/go/types/stmt.go index 24a47901f8..f4c158da91 100644 --- a/src/pkg/go/types/stmt.go +++ b/src/pkg/go/types/stmt.go @@ -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) }