summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorEvan Kroske <evankroske@google.com>2014-10-06 17:16:39 -0400
committerEvan Kroske <evankroske@google.com>2014-10-06 17:16:39 -0400
commit68c0db9ea9d37fdbbe96f106514d4793a7b7fdca (patch)
treedf503ad000ae7466fed927aebb827547d228721a /test
parent746f251c178ec15bfdb422ddc55af8f343b1f593 (diff)
downloadgo-68c0db9ea9d37fdbbe96f106514d4793a7b7fdca.tar.gz
cmd/gc: prohibit short variable declarations containing duplicate symbols
Fixes issue 6764. Fixes issue 8435. LGTM=rsc R=golang-codereviews, r, gobot, rsc CC=golang-codereviews https://codereview.appspot.com/116440046 Committer: Russ Cox <rsc@golang.org>
Diffstat (limited to 'test')
-rw-r--r--test/assign.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/assign.go b/test/assign.go
index da0192f83..6611f8ce3 100644
--- a/test/assign.go
+++ b/test/assign.go
@@ -53,4 +53,16 @@ func main() {
_ = x
_ = y
}
+ {
+ var x = 1
+ {
+ x, x := 2, 3 // ERROR "x repeated on left side of :="
+ _ = x
+ }
+ _ = x
+ }
+ {
+ a, a := 1, 2 // ERROR "a repeated on left side of :="
+ _ = a
+ }
}