Commit 3c7a8124 authored by Robert Griesemer's avatar Robert Griesemer

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: 's avatarMatthew Dempsky <mdempsky@google.com>
parent 73a44f04
...@@ -3436,7 +3436,7 @@ func typecheckas2(n *Node) { ...@@ -3436,7 +3436,7 @@ func typecheckas2(n *Node) {
} }
mismatch: 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 // second half of dance
out: out:
......
...@@ -9,14 +9,14 @@ ...@@ -9,14 +9,14 @@
package main package main
func f1() { func f1() {
a, b := f() // ERROR "mismatch|does not match" a, b := f() // ERROR "cannot assign|does not match"
_ = a _ = a
_ = b _ = b
} }
func f2() { func f2() {
var a, b int var a, b int
a, b = f() // ERROR "mismatch|does not match" a, b = f() // ERROR "cannot assign|does not match"
_ = a _ = a
_ = b _ = b
} }
......
...@@ -14,8 +14,8 @@ func G() (int, int, int) { ...@@ -14,8 +14,8 @@ func G() (int, int, int) {
} }
func F() { func F() {
a, b := G() // ERROR "mismatch" a, b := G() // ERROR "cannot assign"
a, b = G() // ERROR "mismatch" a, b = G() // ERROR "cannot assign"
_, _ = a, b _, _ = a, b
} }
......
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