diff --git a/src/cmd/compile/internal/gc/typecheck.go b/src/cmd/compile/internal/gc/typecheck.go index a6c54f4569..ab2c77a3fb 100644 --- a/src/cmd/compile/internal/gc/typecheck.go +++ b/src/cmd/compile/internal/gc/typecheck.go @@ -3426,7 +3426,7 @@ func typecheckas2(n *Node) { } mismatch: - yyerror("cannot assign %d values to %d variables", cr, cl) + yyerror("assignment mismatch: %d variables but %d values", cl, cr) // second half of dance out: diff --git a/test/fixedbugs/bug289.go b/test/fixedbugs/bug289.go index a3f729557c..3fc7fb2eef 100644 --- a/test/fixedbugs/bug289.go +++ b/test/fixedbugs/bug289.go @@ -9,14 +9,14 @@ package main func f1() { - a, b := f() // ERROR "cannot assign|does not match" + a, b := f() // ERROR "assignment mismatch|does not match" _ = a _ = b } func f2() { var a, b int - a, b = f() // ERROR "cannot assign|does not match" + a, b = f() // ERROR "assignment mismatch|does not match" _ = a _ = b } diff --git a/test/fixedbugs/bug487.go b/test/fixedbugs/bug487.go index 60a4ea9808..ab61a19a94 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 "cannot assign" - a, b = G() // ERROR "cannot assign" + a, b := G() // ERROR "assignment mismatch" + a, b = G() // ERROR "assignment mismatch" _, _ = a, b }