1
0
mirror of https://github.com/golang/go synced 2024-11-18 03:54:50 -07:00

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/38313
Reviewed-by: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
Jeremy Jackins 2017-03-16 15:49:06 -07:00 committed by Robert Griesemer
parent 495b167919
commit 73a44f0456

View File

@ -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: