Skip to content

Instantly share code, notes, and snippets.

@apstndb
Created April 22, 2020 14:54
Show Gist options
  • Save apstndb/8bda40aaa8da92bd3eab85860faedea9 to your computer and use it in GitHub Desktop.
Save apstndb/8bda40aaa8da92bd3eab85860faedea9 to your computer and use it in GitHub Desktop.
$ ./go2go run main.go2
true
$ ./go2go translate main.go2
$ cat main.go
// Code generated by go2go; DO NOT EDIT.


//line main.go2:1
package main

//line main.go2:1
import "fmt"

//line main.go2:13
type Test struct{}

func (Test) Equal(_ Test) bool {
        return true
}

func main() {
        fmt.Println(instantiate୦୦Eq୦main୮aTest(Test{}, Test{}))
}
//line main.go2:9
func instantiate୦୦Eq୦main୮aTest(left, right Test,) bool {
        return left.Equal(right)
}

//line main.go2:11
type Importable୦ int

//line main.go2:11
var _ = fmt.Errorf
package main
import "fmt"
contract contract(T) {
T Equal(T) bool
}
func Eq(type T contract)(left, right T) bool {
return left.Equal(right)
}
type Test struct {}
func (Test) Equal(_ Test) bool {
return true
}
func main() {
fmt.Println(Eq(Test{}, Test{}))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment