github.com/gnolang/gno@v0.0.0-20240520182011-228e9d0192ce/gnovm/tests/files/type39a.gno (about)

     1  package main
     2  
     3  type foo interface {
     4  	say()
     5  }
     6  
     7  type FF foo
     8  
     9  func (f FF) echo() int {
    10  	return 1
    11  }
    12  
    13  type Bar struct{}
    14  
    15  func (b *Bar) say() {}
    16  
    17  func main() {
    18  	var f foo
    19  	f = &Bar{}
    20  	println(f.echo())
    21  }
    22  
    23  // Error:
    24  // main/files/type39a.gno:9: invalid receiver type main.FF (base type is interface type)