Commit 73a44f04 authored by Jeremy Jackins's avatar Jeremy Jackins Committed by Robert Griesemer

cmd/compile: further clarify assignment count mismatch error message

This is an evolution of https://go-review.googlesource.com/33616, as discussed
via email with Robert (gri):

$ cat foobar.go
package main

func main() {
        a := "foo", "bar"
}

before:
./foobar.go:4:4: assignment count mismatch: want 1 values, got 2

after:
./foobar.go:4:4: assignment count mismatch: cannot assign 2 values to 1 variables

We could likely also eliminate the "assignment count mismatch" prefix now
without losing any information, but that string is matched by a number of
tests.

Change-Id: Ie6fc8a7bbd0ebe841d53e66e5c2f49868decf761
Reviewed-on: https://go-review.googlesource.com/38313Reviewed-by: 's avatarRobert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent 495b1679
......@@ -3436,7 +3436,7 @@ func typecheckas2(n *Node) {
}
mismatch:
yyerror("assignment count mismatch: want %d values, got %d", cl, cr)
yyerror("assignment count mismatch: cannot assign %d values to %d variables", cr, cl)
// second half of dance
out:
......
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