github.com/traefik/yaegi@v0.15.1/_test/issue-1515.go (about) 1 package main 2 3 type I1 interface { 4 I2 5 Wrap() *S3 6 } 7 8 type I2 interface { 9 F() 10 } 11 12 type S2 struct { 13 I2 14 } 15 16 func newS2(i2 I2) I1 { 17 return &S2{i2} 18 } 19 20 type S3 struct { 21 base *S2 22 } 23 24 func (s *S2) Wrap() *S3 { 25 i2 := s 26 return &S3{i2} 27 } 28 29 type T struct { 30 name string 31 } 32 33 func (t *T) F() { println("in F", t.name) } 34 35 func main() { 36 t := &T{"test"} 37 s2 := newS2(t) 38 s3 := s2.Wrap() 39 s3.base.F() 40 } 41 42 // Output: 43 // in F test