Commit 029457aa authored by Robert Griesemer's avatar Robert Griesemer

go/types: don't crash when assigning to undefined variables

R=adonovan
CC=golang-dev
https://golang.org/cl/7369059
parent 877153f0
......@@ -62,6 +62,10 @@ func (check *checker) assign1to1(lhs, rhs ast.Expr, x *operand, decl bool, iota
}
}
if x.mode == invalid || z.mode == invalid {
return
}
check.assignOperand(&z, x)
if x.mode != invalid && z.mode == constant {
check.errorf(x.pos(), "cannot assign %s to %s", x, &z)
......
......@@ -32,6 +32,8 @@ func _() {
var u64 uint64
u64 += 1<<u64
undeclared /* ERROR "undeclared" */ = 991
}
func _incdecs() {
......
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