mirror of
https://github.com/golang/go
synced 2024-10-14 03:43:28 +00:00
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 <gri@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
parent
73a44f0456
commit
3c7a812485
|
@ -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:
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue