Commit abbbb428 authored by Alan Donovan's avatar Alan Donovan

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
parent 0bc38b7f
......@@ -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)
}
......
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