github.com/HaHadaxigua/yaegi@v1.0.1/_test/convert0.go (about)

     1  package main
     2  
     3  type T struct {
     4  	v int
     5  }
     6  
     7  type comparator func(T, T) bool
     8  
     9  func sort(items []T, comp comparator) {
    10  	println("in sort")
    11  }
    12  
    13  func compT(t0, t1 T) bool { return t0.v < t1.v }
    14  
    15  func main() {
    16  	a := []T{}
    17  	sort(a, comparator(compT))
    18  }
    19  
    20  // Output:
    21  // in sort