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

     1  package main
     2  
     3  import "fmt"
     4  
     5  var (
     6  	t *S
     7  	_ I = t
     8  	_ J = t
     9  )
    10  
    11  type S struct {
    12  	Name string
    13  }
    14  
    15  func (s *S) F() int { return len(s.Name) }
    16  func (s *S) G() int { return s.F() }
    17  func (s *S) Ri() I  { return s }
    18  func (s *S) Rj() J  { return s }
    19  
    20  type J interface {
    21  	I
    22  	G() int
    23  	Rj() J
    24  }
    25  
    26  type I interface {
    27  	F() int
    28  	Ri() I
    29  }
    30  
    31  func main() {
    32  	var j J
    33  	fmt.Println(j)
    34  }
    35  
    36  // Output:
    37  // <nil>