summaryrefslogtreecommitdiff
path: root/test/bugs
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2011-09-14 10:31:51 -0700
committerIan Lance Taylor <iant@golang.org>2011-09-14 10:31:51 -0700
commit094c027ffcc611901e593b24457df1c981a23476 (patch)
tree9029da57c0762fca4d45f77b8955b6d7c588886c /test/bugs
parentd4ff804dedec4c0ac2d03fa6d5d85c84ebe93450 (diff)
downloadgo-094c027ffcc611901e593b24457df1c981a23476.tar.gz
test: Add test for inheriting private method from anonymous field.
The spec says that all methods are inherited from an anonymous field. There is no exception for non-exported methods. This is related to issue 1536. R=rsc CC=golang-dev http://codereview.appspot.com/5012043
Diffstat (limited to 'test/bugs')
-rw-r--r--test/bugs/bug367.dir/main.go12
-rw-r--r--test/bugs/bug367.dir/p.go16
-rw-r--r--test/bugs/bug367.go7
3 files changed, 35 insertions, 0 deletions
diff --git a/test/bugs/bug367.dir/main.go b/test/bugs/bug367.dir/main.go
new file mode 100644
index 000000000..ab5d1702b
--- /dev/null
+++ b/test/bugs/bug367.dir/main.go
@@ -0,0 +1,12 @@
+package main
+
+import (
+ "./p"
+)
+
+type T struct{ *p.S }
+
+func main() {
+ var t T
+ p.F(t)
+}
diff --git a/test/bugs/bug367.dir/p.go b/test/bugs/bug367.dir/p.go
new file mode 100644
index 000000000..4e27d4e00
--- /dev/null
+++ b/test/bugs/bug367.dir/p.go
@@ -0,0 +1,16 @@
+package p
+
+type T struct{ x int }
+type S struct{}
+
+func (p *S) get() T {
+ return T{0}
+}
+
+type I interface {
+ get() T
+}
+
+func F(i I) {
+ _ = i.get()
+}
diff --git a/test/bugs/bug367.go b/test/bugs/bug367.go
new file mode 100644
index 000000000..073e3b180
--- /dev/null
+++ b/test/bugs/bug367.go
@@ -0,0 +1,7 @@
+// $G $D/$F.dir/p.go && $G $D/$F.dir/main.go && $L main.$A && ./$A.out || echo BUG: should not fail
+
+// 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.
+
+ignored