aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael Stapelberg <stapelberg@google.com>2016-11-29 02:45:11 -0800
committerRobert Griesemer <gri@golang.org>2017-03-14 19:43:38 +0000
commit88cf932e98db8fe014399e05320128d76183f3fa (patch)
tree945f416fd2d247a9f7729ec69309fce3856305fd /src
parent91d08e3bca1c12f45d105ada3f4f46a73375dac9 (diff)
downloadgo-88cf932e98db8fe014399e05320128d76183f3fa.tar.xz
cmd/compile: improve assignment count mismatch error message
Given the following test cases: $ cat left_too_many.go package main func main() { a, err := make([]int, 1) } $ cat right_too_many.go package main func main() { a := "foo", "bar" } Before this change, the error messages are: ./left_too_many.go:4: assignment count mismatch: 2 = 1 ./right_too_many.go:4: assignment count mismatch: 1 = 2 After this change, the error messages are: ./left_too_many.go:4: assignment count mismatch: want 2 values, got 1 ./right_too_many.go:4: assignment count mismatch: want 1 values, got 2 Change-Id: I9ad346f122406bc9a785bf690ed7b3de76a422da Reviewed-on: https://go-review.googlesource.com/33616 Reviewed-by: Robert Griesemer <gri@golang.org> Run-TryBot: Robert Griesemer <gri@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src')
-rw-r--r--src/cmd/compile/internal/gc/typecheck.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/cmd/compile/internal/gc/typecheck.go b/src/cmd/compile/internal/gc/typecheck.go
index 0c0782d40f..8299e49a34 100644
--- a/src/cmd/compile/internal/gc/typecheck.go
+++ b/src/cmd/compile/internal/gc/typecheck.go
@@ -3429,7 +3429,7 @@ func typecheckas2(n *Node) {
}
mismatch:
- yyerror("assignment count mismatch: %d = %d", cl, cr)
+ yyerror("assignment count mismatch: want %d values, got %d", cl, cr)
// second half of dance
out: