summaryrefslogtreecommitdiff
path: root/test/ddd.go
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2012-03-07 08:24:10 -0800
committerIan Lance Taylor <iant@golang.org>2012-03-07 08:24:10 -0800
commite54ad64ff346281b707c75c72566b63080864dcf (patch)
tree6c279c02a1ef80a3ed13cb82c8ce8ecbc94676b0 /test/ddd.go
parent08854b022fec37e16d35e3e4e029e703f1911463 (diff)
downloadgo-git-e54ad64ff346281b707c75c72566b63080864dcf.tar.gz
test: add inherited interface test to ddd.go
The gccgo compiler incorrectly gave an error for this code. R=golang-dev, rsc CC=golang-dev https://golang.org/cl/5767043
Diffstat (limited to 'test/ddd.go')
-rw-r--r--test/ddd.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/ddd.go b/test/ddd.go
index f35836331b..3b595b5f8d 100644
--- a/test/ddd.go
+++ b/test/ddd.go
@@ -60,6 +60,10 @@ type U struct {
*T
}
+type I interface {
+ Sum(...int) int
+}
+
func main() {
if x := sum(1, 2, 3); x != 6 {
println("sum 6", x)
@@ -207,6 +211,14 @@ func main() {
println("i(=u).Sum", x)
panic("fail")
}
+ var s struct {
+ I
+ }
+ s.I = &u
+ if x := s.Sum(2, 3, 5, 8); x != 18 {
+ println("s{&u}.Sum", x)
+ panic("fail")
+ }
/* TODO(rsc): Enable once nested method expressions work.
if x := (*U).Sum(&U{}, 1, 3, 5, 2); x != 11 {
println("(*U).Sum", x)