]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: eliminate "assignment count mismatch" - not needed anymore
authorRobert Griesemer <gri@golang.org>
Fri, 17 Mar 2017 00:07:26 +0000 (17:07 -0700)
committerRobert Griesemer <gri@golang.org>
Fri, 17 Mar 2017 00:31:35 +0000 (00:31 +0000)
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 <gri@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
src/cmd/compile/internal/gc/typecheck.go
test/fixedbugs/bug289.go
test/fixedbugs/bug487.go

index 2f67b33381bfde8a88251d098c3ba9775004ac15..d55e76b7f140f4b1b606874f0b87d06267fd8cb8 100644 (file)
@@ -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:
index 5a30979838991629fb2c54ca169e1ab83007019f..a3f729557cd5a339788e7111ed6ee99c6f56449e 100644 (file)
@@ -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
 }
index e60af6c8e23b2dd6b0a11f85981f2e8585e766df..60a4ea9808bf6630f1371885505fe94e8cb8292a 100644 (file)
@@ -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
 }