summaryrefslogtreecommitdiff
path: root/test/funcdup2.go
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2013-03-15 15:24:13 -0400
committerRuss Cox <rsc@golang.org>2013-03-15 15:24:13 -0400
commitaeff7ec9e52430e055d42d24dee2b10eb3664b20 (patch)
tree96b1e33536c4a03499ebc52aae24f60ef84d5c1b /test/funcdup2.go
parentfe6186a0b3cbb941424215999027e8a14ad0b1c0 (diff)
downloadgo-aeff7ec9e52430e055d42d24dee2b10eb3664b20.tar.gz
cmd/gc: ensure unique parameter and result names in function types
In addition to fixing the bug, the check is now linear instead of quadratic. Fixes issue 4469. R=ken2 CC=golang-dev https://codereview.appspot.com/7773047
Diffstat (limited to 'test/funcdup2.go')
-rw-r--r--test/funcdup2.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/funcdup2.go b/test/funcdup2.go
new file mode 100644
index 000000000..aeb5f7eb6
--- /dev/null
+++ b/test/funcdup2.go
@@ -0,0 +1,17 @@
+// errorcheck
+
+// Copyright 2013 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package p
+
+var T interface {
+ F1(i int) (i int) // ERROR "duplicate argument i"
+ F2(i, i int) // ERROR "duplicate argument i"
+ F3() (i, i int) // ERROR "duplicate argument i"
+}
+
+var T1 func(i, i int) // ERROR "duplicate argument i"
+var T2 func(i int) (i int) // ERROR "duplicate argument i"
+var T3 func() (i, i int) // ERROR "duplicate argument i"