Skip to content

Commit 88cf932

Browse files
stapelberggriesemer
authored andcommitted
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 <[email protected]> Run-TryBot: Robert Griesemer <[email protected]> TryBot-Result: Gobot Gobot <[email protected]>
1 parent 91d08e3 commit 88cf932

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/cmd/compile/internal/gc/typecheck.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3429,7 +3429,7 @@ func typecheckas2(n *Node) {
34293429
}
34303430

34313431
mismatch:
3432-
yyerror("assignment count mismatch: %d = %d", cl, cr)
3432+
yyerror("assignment count mismatch: want %d values, got %d", cl, cr)
34333433

34343434
// second half of dance
34353435
out:

0 commit comments

Comments
 (0)