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

     1  package main
     2  
     3  import "reflect"
     4  
     5  type I interface {
     6  	Foo() int
     7  }
     8  
     9  type T struct {
    10  	Name string
    11  }
    12  
    13  func (t T) Foo() int { return 0 }
    14  
    15  func f(v reflect.Value) int {
    16  	i := v.Interface().(I)
    17  	return i.Foo()
    18  }
    19  
    20  func main() {
    21  	println("hello")
    22  }
    23  
    24  // Output:
    25  // hello