From: Jeremy Jackins Date: Thu, 16 Mar 2017 22:49:06 +0000 (-0700) Subject: cmd/compile: further clarify assignment count mismatch error message X-Git-Tag: go1.9beta1~1138 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=73a44f0456389c60db8459981868b4c64874ec0b;p=gostls13.git 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 Run-TryBot: Robert Griesemer TryBot-Result: Gobot Gobot --- diff --git a/src/cmd/compile/internal/gc/typecheck.go b/src/cmd/compile/internal/gc/typecheck.go index 0425996b81..2f67b33381 100644 --- a/src/cmd/compile/internal/gc/typecheck.go +++ b/src/cmd/compile/internal/gc/typecheck.go @@ -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: