github.com/traefik/yaegi@v0.15.1/_test/method34.go (about)

     1  package main
     2  
     3  type Root struct {
     4  	Name string
     5  }
     6  
     7  type One struct {
     8  	Root
     9  }
    10  
    11  type Hi interface {
    12  	Hello() string
    13  }
    14  
    15  type Hey interface {
    16  	Hello() string
    17  }
    18  
    19  func (r *Root) Hello() string { return "Hello " + r.Name }
    20  
    21  func main() {
    22  	// TODO(mpl): restore when type assertions work again.
    23  	// var one interface{} = &One{Root{Name: "test2"}}
    24  	var one Hey = &One{Root{Name: "test2"}}
    25  	println(one.(Hi).Hello())
    26  }
    27  
    28  // Output:
    29  // Hello test2