Keep left-to-right order when referring to the number of
variables and values involved.
Fixes #22159.
Change-Id: Iccca12d3222f9d5e049939a9ccec07513c393faa
Reviewed-on: https://go-review.googlesource.com/68690
Reviewed-by: Russ Cox <rsc@golang.org>
}
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:
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
}
}
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
}