cmd/compile: eliminate "assignment count mismatch" - not needed anymore

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>
This commit is contained in:
Robert Griesemer 2017-03-16 17:07:26 -07:00
parent 73a44f0456
commit 3c7a812485
3 changed files with 5 additions and 5 deletions

View file

@ -3436,7 +3436,7 @@ func typecheckas2(n *Node) {
}
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:

View file

@ -9,14 +9,14 @@
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
}

View file

@ -14,8 +14,8 @@ func G() (int, int, int) {
}
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
}