summaryrefslogtreecommitdiff
path: root/test/fixedbugs
diff options
context:
space:
mode:
Diffstat (limited to 'test/fixedbugs')
-rw-r--r--test/fixedbugs/bug226.dir/y.go2
-rw-r--r--test/fixedbugs/bug322.dir/lib.go15
-rw-r--r--test/fixedbugs/bug322.dir/main.go40
-rw-r--r--test/fixedbugs/bug322.go8
-rw-r--r--test/fixedbugs/bug342.go24
-rw-r--r--test/fixedbugs/bug343.go33
6 files changed, 121 insertions, 1 deletions
diff --git a/test/fixedbugs/bug226.dir/y.go b/test/fixedbugs/bug226.dir/y.go
index 01e8b7b43..c66d592b7 100644
--- a/test/fixedbugs/bug226.dir/y.go
+++ b/test/fixedbugs/bug226.dir/y.go
@@ -15,7 +15,7 @@ func f() {
_ = x.T{};
_ = x.T{Y:2};
- ok1.M(); // ERROR "assignment.*T"
+ ok1.M();
bad1 := *ok; // ERROR "assignment.*T"
bad2 := ok1; // ERROR "assignment.*T"
*ok4 = ok1; // ERROR "assignment.*T"
diff --git a/test/fixedbugs/bug322.dir/lib.go b/test/fixedbugs/bug322.dir/lib.go
new file mode 100644
index 000000000..0de56d3d6
--- /dev/null
+++ b/test/fixedbugs/bug322.dir/lib.go
@@ -0,0 +1,15 @@
+// Copyright 2011 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 lib
+
+type T struct {
+ x int // non-exported field
+}
+
+func (t T) M() {
+}
+
+func (t *T) PM() {
+}
diff --git a/test/fixedbugs/bug322.dir/main.go b/test/fixedbugs/bug322.dir/main.go
new file mode 100644
index 000000000..f403c7d32
--- /dev/null
+++ b/test/fixedbugs/bug322.dir/main.go
@@ -0,0 +1,40 @@
+// Copyright 2011 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 main
+
+import "./lib"
+
+type I interface {
+ M()
+}
+
+type PI interface {
+ PM()
+}
+
+func main() {
+ var t lib.T
+ t.M()
+ t.PM()
+
+ // This is still an error.
+ // var i1 I = t
+ // i1.M()
+
+ // This combination is illegal because
+ // PM requires a pointer receiver.
+ // var pi1 PI = t
+ // pi1.PM()
+
+ var pt = &t
+ pt.M()
+ pt.PM()
+
+ var i2 I = pt
+ i2.M()
+
+ var pi2 PI = pt
+ pi2.PM()
+}
diff --git a/test/fixedbugs/bug322.go b/test/fixedbugs/bug322.go
new file mode 100644
index 000000000..ad0e62dc8
--- /dev/null
+++ b/test/fixedbugs/bug322.go
@@ -0,0 +1,8 @@
+// $G $D/$F.dir/lib.go && $G $D/$F.dir/main.go && $L main.$A && ./$A.out || echo BUG: fails incorrectly
+
+// Copyright 2011 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.
+
+// Test case for issue 1402.
+ignored
diff --git a/test/fixedbugs/bug342.go b/test/fixedbugs/bug342.go
new file mode 100644
index 000000000..0852cdd34
--- /dev/null
+++ b/test/fixedbugs/bug342.go
@@ -0,0 +1,24 @@
+// errchk $G $D/$F.go
+
+// Copyright 2011 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.
+
+// Issue 1871.
+
+package p
+
+type a interface {
+ foo(x int) (x int) // ERROR "redeclared|redefinition"
+}
+
+var b interface {
+ bar(y int) (y int) // ERROR "redeclared|redefinition"
+}
+
+/*
+Previously:
+
+bug.go:1 x redclared in this block
+ previous declaration at bug.go:1
+*/
diff --git a/test/fixedbugs/bug343.go b/test/fixedbugs/bug343.go
new file mode 100644
index 000000000..efc87e3d7
--- /dev/null
+++ b/test/fixedbugs/bug343.go
@@ -0,0 +1,33 @@
+// $G $D/$F.go && $L $F.$A && ./$A.out || echo BUG: bug343
+
+// Copyright 2011 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.
+
+// issue 1900
+
+package main
+
+func getArgs(data map[string]interface{}, keys ...string) map[string]string {
+ ret := map[string]string{}
+ var ok bool
+ for _, k := range keys {
+ ret[k], ok = data[k].(string)
+ if !ok {}
+ }
+ return ret
+}
+
+func main() {
+ x := getArgs(map[string]interface{}{"x":"y"}, "x")
+ if x["x"] != "y" {
+ println("BUG bug343", x)
+ }
+}
+
+
+/*
+typecheck [1008592b0]
+. INDREG a(1) l(15) x(24) tc(2) runtime.ret G0 string
+bug343.go:15: internal compiler error: typecheck INDREG
+*/