From: Robert Griesemer Date: Fri, 17 Mar 2017 00:07:26 +0000 (-0700) Subject: cmd/compile: eliminate "assignment count mismatch" - not needed anymore X-Git-Tag: go1.9beta1~1137 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=3c7a812485334eb57c0856e6b152aa3d50f9f0a0;p=gostls13.git cmd/compile: eliminate "assignment count mismatch" - not needed anymore See https://go-review.googlesource.com/#/c/38313/ for background. It turns out that only a few tests checked for this. The new error message is shorter and very clear. Change-Id: I8ab4ad59fb023c8b54806339adc23aefd7dc7b07 Reviewed-on: https://go-review.googlesource.com/38314 Run-TryBot: Robert Griesemer Reviewed-by: Matthew Dempsky --- diff --git a/src/cmd/compile/internal/gc/typecheck.go b/src/cmd/compile/internal/gc/typecheck.go index 2f67b33381..d55e76b7f1 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: cannot assign %d values to %d variables", cr, cl) + yyerror("cannot assign %d values to %d variables", cr, cl) // second half of dance out: diff --git a/test/fixedbugs/bug289.go b/test/fixedbugs/bug289.go index 5a30979838..a3f729557c 100644 --- a/test/fixedbugs/bug289.go +++ b/test/fixedbugs/bug289.go @@ -9,14 +9,14 @@ package main func f1() { - a, b := f() // ERROR "mismatch|does not match" + a, b := f() // ERROR "cannot assign|does not match" _ = a _ = b } func f2() { var a, b int - a, b = f() // ERROR "mismatch|does not match" + a, b = f() // ERROR "cannot assign|does not match" _ = a _ = b } diff --git a/test/fixedbugs/bug487.go b/test/fixedbugs/bug487.go index e60af6c8e2..60a4ea9808 100644 --- a/test/fixedbugs/bug487.go +++ b/test/fixedbugs/bug487.go @@ -14,8 +14,8 @@ func G() (int, int, int) { } func F() { - a, b := G() // ERROR "mismatch" - a, b = G() // ERROR "mismatch" + a, b := G() // ERROR "cannot assign" + a, b = G() // ERROR "cannot assign" _, _ = a, b }