1
0
mirror of https://github.com/golang/go synced 2024-09-23 13:20:14 -06:00

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
This commit is contained in:
Ian Lance Taylor 2012-03-07 08:24:10 -08:00
parent 08854b022f
commit e54ad64ff3

View File

@ -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)