See https://go-review.googlesource.com/#/c/38313/ for background.
It turns out that only a few tests checked for this.
The new error message is shorter and very clear.
Change-Id: I8ab4ad59fb023c8b54806339adc23aefd7dc7b07
Reviewed-on: https://go-review.googlesource.com/38314
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
}
mismatch:
- yyerror("assignment count mismatch: cannot assign %d values to %d variables", cr, cl)
+ yyerror("cannot assign %d values to %d variables", cr, cl)
// second half of dance
out:
package main
func f1() {
- a, b := f() // ERROR "mismatch|does not match"
+ a, b := f() // ERROR "cannot assign|does not match"
_ = a
_ = b
}
func f2() {
var a, b int
- a, b = f() // ERROR "mismatch|does not match"
+ a, b = f() // ERROR "cannot assign|does not match"
_ = a
_ = b
}
}
func F() {
- a, b := G() // ERROR "mismatch"
- a, b = G() // ERROR "mismatch"
+ a, b := G() // ERROR "cannot assign"
+ a, b = G() // ERROR "cannot assign"
_, _ = a, b
}