Created
April 22, 2020 14:54
-
-
Save apstndb/8bda40aaa8da92bd3eab85860faedea9 to your computer and use it in GitHub Desktop.
Revisions
-
apstndb renamed this gist
Apr 22, 2020 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
apstndb created this gist
Apr 22, 2020 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,38 @@ ``` $ ./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 ``` This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,21 @@ 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{})) }