github.com/goplus/gop@v1.2.6/testdata/mixgo-complex/foo.gop (about)

     1  // Pkg doc
     2  
     3  import (
     4  	"io"
     5  	"log"
     6  )
     7  
     8  type ift2 interface {
     9  	io.Closer
    10  	f(int) string
    11  	g()
    12  }
    13  
    14  // T doc
    15  type T struct {
    16  	io.Closer
    17  }
    18  
    19  func (T) Close() (err error) {
    20  	log.Println("Hi!")
    21  	return
    22  }
    23  
    24  func (t T) g() {}
    25  
    26  func (t T) f(a int) (b string) {
    27  	_ = t.Closer
    28  	return
    29  }
    30  
    31  func Foo(i *impl) string {
    32  	i.a.f(0)
    33  	i.a.g()
    34  	return ""
    35  }
    36  
    37  // foo golang/go#61561: interface instances aren't concurrency-safe
    38  // as they are not completed by the type checker.
    39  func foo(a, b int) string {
    40  	return ""
    41  }
    42  
    43  println "Hello, world", T{}.f(0)