Repository: goplus/gop
Pull request #1586 (2023-12-22 07:03:11)

cl: goxRecorder.call for overload func


Patch:
diff --git a/cl/recorder.go b/cl/recorder.go
index e4820274..ba29ef9e 100644
--- a/cl/recorder.go
+++ b/cl/recorder.go
@@ -47,6 +47,19 @@ func (p *goxRecorder) Member(id ast.Node, obj types.Object) {
 	}
 }
 
+func (p *goxRecorder) Call(id ast.Node, obj types.Object) {
+	switch v := id.(type) {
+	case *ast.CallExpr:
+		switch id := v.Fun.(type) {
+		case *ast.Ident:
+			p.rec.Use(id, obj)
+		case *ast.SelectorExpr:
+			p.rec.Use(id.Sel, obj)
+		}
+		p.rec.Type(v.Fun, typesutil.NewTypeAndValueForObject(obj))
+	}
+}
+
 type typesRecorder struct {
 	Recorder
 	types map[ast.Expr]types.TypeAndValue
diff --git a/go.mod b/go.mod
index 31e089c5..8c2a29f9 100644
--- a/go.mod
+++ b/go.mod
@@ -4,8 +4,8 @@ go 1.18
 
 require (
 	github.com/fsnotify/fsnotify v1.7.0
-	github.com/goplus/c2go v0.7.18
-	github.com/goplus/gox v1.13.1
+	github.com/goplus/c2go v0.7.17
+	github.com/goplus/gox v1.13.1-0.20231222052208-e6decd192e88
 	github.com/goplus/mod v0.11.10-0.20231210062211-b9032d0f7810
 	github.com/qiniu/x v1.13.2
 	golang.org/x/tools v0.16.1
diff --git a/go.sum b/go.sum
index a154d83f..80b02b45 100644
--- a/go.sum
+++ b/go.sum
@@ -4,10 +4,11 @@ github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs
 github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA=
 github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM=
 github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
-github.com/goplus/c2go v0.7.18 h1:lymExgcOTTfMSe8eGlZm3LntBmueDpgNEQQsnLlY3qg=
-github.com/goplus/c2go v0.7.18/go.mod h1:XZJUGrDT0uD0a7clRNRJF8gAi1zfHfFbA8UVIlPqz2w=
-github.com/goplus/gox v1.13.1 h1:/X6Ja9R2hQuLVbN+PzLHRtaBcan+YmhASvGO3nMJsZw=
-github.com/goplus/gox v1.13.1/go.mod h1:UNzOPlRyO/uQn+9iHelk6KelAFaaC7OBn5AxtSSsC9c=
+github.com/goplus/c2go v0.7.17 h1:q/b0Fv1ggJUo0E0ZN/3t8zoE9vmJYTDtAlNSzedeCAA=
+github.com/goplus/c2go v0.7.17/go.mod h1:HhlHE5OAwrJyjg3Dz6yj3b1drugJdoUiWeUl+G3NnU4=
+github.com/goplus/gox v1.13.0/go.mod h1:MOJnwqA8/rSUkn0vsayHFK7TD/3XQrdexMTqdzR70X0=
+github.com/goplus/gox v1.13.1-0.20231222052208-e6decd192e88 h1:AIEOfpJP+ES2A/kbIfazM8NRy/kTyFiLL9fcg1gDKjo=
+github.com/goplus/gox v1.13.1-0.20231222052208-e6decd192e88/go.mod h1:iIchh0wp8Ye0DOPcFgHc5d0qlMOx8/OJ+DBQfe7hcTs=
 github.com/goplus/mod v0.11.9/go.mod h1:YxrBMhvWGcvLU14j8e7qyKSVnj5Loba7GgH1rNXJtDg=
 github.com/goplus/mod v0.11.10-0.20231210062211-b9032d0f7810 h1:d+1SoTwaKrHwMp2EZPzZxV8VnqVr+QxXQCtz/zn+Tow=
 github.com/goplus/mod v0.11.10-0.20231210062211-b9032d0f7810/go.mod h1:YxrBMhvWGcvLU14j8e7qyKSVnj5Loba7GgH1rNXJtDg=
@@ -29,10 +30,11 @@ github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5t
 golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
 golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
 golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc=
-golang.org/x/crypto v0.15.0/go.mod h1:4ChreQoLWfG3xLDer1WdlH5NdlQ3+mwnQq1YTKY+72g=
+golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4=
 golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
 golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
 golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
+golang.org/x/mod v0.13.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
 golang.org/x/mod v0.14.0 h1:dGoOF9QVLYng8IHTm7BAyWqCqSheQ5pYWGhzW00YJr0=
 golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
 golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
@@ -41,13 +43,13 @@ golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug
 golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
 golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
 golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk=
-golang.org/x/net v0.18.0/go.mod h1:/czyP5RqHAH4odGYxBJ1qz0+CE5WZ+2j1YgoEo8F2jQ=
+golang.org/x/net v0.16.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE=
 golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
 golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
 golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
 golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y=
+golang.org/x/sync v0.4.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y=
 golang.org/x/sync v0.5.0 h1:60k92dhOjHxJkrqnwsfl8KuaHbn/5dl0lUPUklKo3qE=
-golang.org/x/sync v0.5.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
 golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
 golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
 golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
@@ -56,6 +58,7 @@ golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBc
 golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
 golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
 golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
 golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q=
 golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
 golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
@@ -63,20 +66,19 @@ golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuX
 golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
 golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo=
 golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU=
-golang.org/x/term v0.14.0/go.mod h1:TySc+nGkYR6qt8km8wUhuFRTVSMIX3XPR58y2lC8vww=
+golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U=
 golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
 golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
 golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
 golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
 golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
 golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
-golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
 golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
 golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
 golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
 golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
 golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58=
-golang.org/x/tools v0.15.0/go.mod h1:hpksKq4dtpQWS1uQ61JkdqWM3LscIS6Slf+VVkm+wQk=
+golang.org/x/tools v0.14.0/go.mod h1:uYBEerGOWcJyEORxN+Ek8+TT266gXkNlHdJBwexUsBg=
 golang.org/x/tools v0.16.1 h1:TLyB3WofjdOEepBHAU20JdNC1Zbg87elYofWYAY5oZA=
 golang.org/x/tools v0.16.1/go.mod h1:kYVVN6I1mBNoB1OX+noeBjbRk4IUEPa7JJ+TJMEooJ0=
 golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=


Test patch:
diff --git a/x/typesutil/info_test.go b/x/typesutil/info_test.go
index c439decd..585d8500 100644
--- a/x/typesutil/info_test.go
+++ b/x/typesutil/info_test.go
@@ -514,14 +514,14 @@ println a
 `, ``, `== types ==
 000:  2: 7 | 100                 *ast.BasicLit                  | value   : untyped int = 100 | constant
 001:  2:11 | 200                 *ast.BasicLit                  | value   : untyped int = 200 | constant
-002:  3: 1 | println             *ast.Ident                     | builtin : invalid type | built-in
+002:  3: 1 | println             *ast.Ident                     | value   : func(a ...any) (n int, err error) | value
 003:  3: 1 | println a           *ast.CallExpr                  | value   : (n int, err error) | value
 004:  3: 9 | a                   *ast.Ident                     | var     : []int | variable
 == defs ==
 000:  2: 1 | a                   | var a []int
 001:  2: 1 | main                | func main.main()
 == uses ==
-000:  3: 1 | println             | builtin println
+000:  3: 1 | println             | func fmt.Println(a ...any) (n int, err error)
 001:  3: 9 | a                   | var a []int`)
 }
 
@@ -548,7 +548,7 @@ println sum
 012:  4: 8 | sum                 *ast.Ident                     | var     : int | variable
 013:  4: 8 | sum + x             *ast.BinaryExpr                | value   : int | value
 014:  4:14 | x                   *ast.Ident                     | var     : int | variable
-015:  6: 1 | println             *ast.Ident                     | builtin : invalid type | built-in
+015:  6: 1 | println             *ast.Ident                     | value   : func(a ...any) (n int, err error) | value
 016:  6: 1 | println sum         *ast.CallExpr                  | value   : (n int, err error) | value
 017:  6: 9 | sum                 *ast.Ident                     | var     : int | variable
 == defs ==
@@ -560,7 +560,7 @@ println sum
 001:  4: 2 | sum                 | var sum int
 002:  4: 8 | sum                 | var sum int
 003:  4:14 | x                   | var x int
-004:  6: 1 | println             | builtin println
+004:  6: 1 | println             | func fmt.Println(a ...any) (n int, err error)
 005:  6: 9 | sum                 | var sum int`)
 }
 
@@ -593,7 +593,7 @@ println sum
 018:  4: 8 | sum                 *ast.Ident                     | var     : int | variable
 019:  4: 8 | sum + x             *ast.BinaryExpr                | value   : int | value
 020:  4:14 | x                   *ast.Ident                     | var     : int | variable
-021:  6: 1 | println             *ast.Ident                     | builtin : invalid type | built-in
+021:  6: 1 | println             *ast.Ident                     | value   : func(a ...any) (n int, err error) | value
 022:  6: 1 | println sum         *ast.CallExpr                  | value   : (n int, err error) | value
 023:  6: 9 | sum                 *ast.Ident                     | var     : int | variable
 == defs ==
@@ -607,7 +607,7 @@ println sum
 002:  4: 2 | sum                 | var sum int
 003:  4: 8 | sum                 | var sum int
 004:  4:14 | x                   | var x int
-005:  6: 1 | println             | builtin println
+005:  6: 1 | println             | func fmt.Println(a ...any) (n int, err error)
 006:  6: 9 | sum                 | var sum int`)
 }
 
@@ -623,7 +623,7 @@ println y
 004:  2:35 | "5"                 *ast.BasicLit                  | value   : untyped string = "5" | constant
 005:  2:40 | "7"                 *ast.BasicLit                  | value   : untyped string = "7" | constant
 006:  2:45 | "11"                *ast.BasicLit                  | value   : untyped string = "11" | constant
-007:  3: 1 | println             *ast.Ident                     | builtin : invalid type | built-in
+007:  3: 1 | println             *ast.Ident                     | value   : func(a ...any) (n int, err error) | value
 008:  3: 1 | println y           *ast.CallExpr                  | value   : (n int, err error) | value
 009:  3: 9 | y                   *ast.Ident                     | var     : map[string]int | variable
 == defs ==
@@ -634,7 +634,7 @@ println y
 == uses ==
 000:  2: 7 | x                   | var x string
 001:  2:10 | i                   | var i int
-002:  3: 1 | println             | builtin println
+002:  3: 1 | println             | func fmt.Println(a ...any) (n int, err error)
 003:  3: 9 | y                   | var y map[string]int`)
 }
 
@@ -686,7 +686,7 @@ println("x:", x)
 013:  3:48 | b                   *ast.Ident                     | var     : float64 | variable
 014:  3:48 | b > 2               *ast.BinaryExpr                | value   : untyped bool | value
 015:  3:52 | 2                   *ast.BasicLit                  | value   : untyped int = 2 | constant
-016:  4: 1 | println             *ast.Ident                     | builtin : invalid type | built-in
+016:  4: 1 | println             *ast.Ident                     | value   : func(a ...any) (n int, err error) | value
 017:  4: 1 | println("x:", x)    *ast.CallExpr                  | value   : (n int, err error) | value
 018:  4: 9 | "x:"                *ast.BasicLit                  | value   : untyped string = "x:" | constant
 019:  4:15 | x                   *ast.Ident                     | var     : [][]float64 | variable
@@ -704,7 +704,7 @@ println("x:", x)
 004:  3:32 | b                   | var b float64
 005:  3:43 | arr                 | var arr []float64
 006:  3:48 | b                   | var b float64
-007:  4: 1 | println             | builtin println
+007:  4: 1 | println             | func fmt.Println(a ...any) (n int, err error)
 008:  4:15 | x                   | var x [][]float64`)
 }
 
@@ -717,7 +717,7 @@ for line <- os.Stdin {
 }
 `, ``, `== types ==
 000:  4:13 | os.Stdin            *ast.SelectorExpr              | var     : *os.File | variable
-001:  5: 2 | println             *ast.Ident                     | builtin : invalid type | built-in
+001:  5: 2 | println             *ast.Ident                     | value   : func(a ...any) (n int, err error) | value
 002:  5: 2 | println line        *ast.CallExpr                  | value   : (n int, err error) | value
 003:  5:10 | line                *ast.Ident                     | var     : string | variable
 == defs ==
@@ -726,7 +726,7 @@ for line <- os.Stdin {
 == uses ==
 000:  4:13 | os                  | package os
 001:  4:16 | Stdin               | var os.Stdin *os.File
-002:  5: 2 | println             | builtin println
+002:  5: 2 | println             | func fmt.Println(a ...any) (n int, err error)
 003:  5:10 | line                | var line string`)
 }
 
@@ -879,3 +879,464 @@ Map2([1.2, 3.5, 6], x => {
 013: 14:16 | x                   | var x float64
 014: 14:20 | x                   | var x float64`)
 }
+
+func TestMixedOverload1(t *testing.T) {
+	testGopInfo(t, `
+type Mesh struct {
+}
+
+func (p *Mesh) Name() string {
+	return "hello"
+}
+
+var (
+	m1 = &Mesh{}
+	m2 = &Mesh{}
+)
+
+OnKey "hello", => {
+}
+OnKey "hello", key => {
+}
+OnKey ["1"], => {
+}
+OnKey ["2"], key => {
+}
+OnKey [m1, m2], => {
+}
+OnKey [m1, m2], key => {
+}
+OnKey ["a"], ["b"], key => {
+}
+OnKey ["a"], [m1, m2], key => {
+}
+OnKey ["a"], nil, key => {
+}
+OnKey 100, 200
+OnKey "a", "b", x => x * x, x => {
+	return x * 2
+}
+OnKey "a", "b", 1, 2, 3
+OnKey("a", "b", [1, 2, 3]...)
+`, `
+package main
+
+type Mesher interface {
+	Name() string
+}
+
+type N struct {
+}
+
+func (m *N) OnKey__0(a string, fn func()) {
+}
+
+func (m *N) OnKey__1(a string, fn func(key string)) {
+}
+
+func (m *N) OnKey__2(a []string, fn func()) {
+}
+
+func (m *N) OnKey__3(a []string, fn func(key string)) {
+}
+
+func (m *N) OnKey__4(a []Mesher, fn func()) {
+}
+
+func (m *N) OnKey__5(a []Mesher, fn func(key Mesher)) {
+}
+
+func (m *N) OnKey__6(a []string, b []string, fn func(key string)) {
+}
+
+func (m *N) OnKey__7(a []string, b []Mesher, fn func(key string)) {
+}
+
+func (m *N) OnKey__8(x int, y int) {
+}
+
+
+func OnKey__0(a string, fn func()) {
+}
+
+func OnKey__1(a string, fn func(key string)) {
+}
+
+func OnKey__2(a []string, fn func()) {
+}
+
+func OnKey__3(a []string, fn func(key string)) {
+}
+
+func OnKey__4(a []Mesher, fn func()) {
+}
+
+func OnKey__5(a []Mesher, fn func(key Mesher)) {
+}
+
+func OnKey__6(a []string, b []string, fn func(key string)) {
+}
+
+func OnKey__7(a []string, b []Mesher, fn func(key string)) {
+}
+
+func OnKey__8(x int, y int) {
+}
+
+func OnKey__9(a, b string, fn ...func(x int) int) {
+}
+
+func OnKey__a(a, b string, v ...int) {
+}
+`, `== types ==
+000:  2:11 | struct {
+}          *ast.StructType                | type    : struct{} | type
+001:  5:10 | Mesh                *ast.Ident                     | type    : main.Mesh | type
+002:  5:23 | string              *ast.Ident                     | type    : string | type
+003:  6: 9 | "hello"             *ast.BasicLit                  | value   : untyped string = "hello" | constant
+004: 10: 7 | &Mesh{}             *ast.UnaryExpr                 | value   : *main.Mesh | value
+005: 10: 8 | Mesh                *ast.Ident                     | type    : main.Mesh | type
+006: 10: 8 | Mesh{}              *ast.CompositeLit              | value   : main.Mesh | value
+007: 11: 7 | &Mesh{}             *ast.UnaryExpr                 | value   : *main.Mesh | value
+008: 11: 8 | Mesh                *ast.Ident                     | type    : main.Mesh | type
+009: 11: 8 | Mesh{}              *ast.CompositeLit              | value   : main.Mesh | value
+010: 14: 1 | OnKey               *ast.Ident                     | value   : func(a string, fn func()) | value
+011: 14: 1 | OnKey "hello", => {
+} *ast.CallExpr                  | void    : () | no value
+012: 14: 7 | "hello"             *ast.BasicLit                  | value   : untyped string = "hello" | constant
+013: 16: 1 | OnKey               *ast.Ident                     | value   : func(a string, fn func(key string)) | value
+014: 16: 1 | OnKey "hello", key => {
+} *ast.CallExpr                  | void    : () | no value
+015: 16: 7 | "hello"             *ast.BasicLit                  | value   : untyped string = "hello" | constant
+016: 18: 1 | OnKey               *ast.Ident                     | value   : func(a []string, fn func()) | value
+017: 18: 1 | OnKey ["1"], => {
+} *ast.CallExpr                  | void    : () | no value
+018: 18: 8 | "1"                 *ast.BasicLit                  | value   : untyped string = "1" | constant
+019: 20: 1 | OnKey               *ast.Ident                     | value   : func(a []string, fn func(key string)) | value
+020: 20: 1 | OnKey ["2"], key => {
+} *ast.CallExpr                  | void    : () | no value
+021: 20: 8 | "2"                 *ast.BasicLit                  | value   : untyped string = "2" | constant
+022: 22: 1 | OnKey               *ast.Ident                     | value   : func(a []main.Mesher, fn func()) | value
+023: 22: 1 | OnKey [m1, m2], => {
+} *ast.CallExpr                  | void    : () | no value
+024: 22: 8 | m1                  *ast.Ident                     | var     : *main.Mesh | variable
+025: 22:12 | m2                  *ast.Ident                     | var     : *main.Mesh | variable
+026: 24: 1 | OnKey               *ast.Ident                     | value   : func(a []main.Mesher, fn func(key main.Mesher)) | value
+027: 24: 1 | OnKey [m1, m2], key => {
+} *ast.CallExpr                  | void    : () | no value
+028: 24: 8 | m1                  *ast.Ident                     | var     : *main.Mesh | variable
+029: 24:12 | m2                  *ast.Ident                     | var     : *main.Mesh | variable
+030: 26: 1 | OnKey               *ast.Ident                     | value   : func(a []string, b []string, fn func(key string)) | value
+031: 26: 1 | OnKey ["a"], ["b"], key => {
+} *ast.CallExpr                  | void    : () | no value
+032: 26: 8 | "a"                 *ast.BasicLit                  | value   : untyped string = "a" | constant
+033: 26:15 | "b"                 *ast.BasicLit                  | value   : untyped string = "b" | constant
+034: 28: 1 | OnKey               *ast.Ident                     | value   : func(a []string, b []main.Mesher, fn func(key string)) | value
+035: 28: 1 | OnKey ["a"], [m1, m2], key => {
+} *ast.CallExpr                  | void    : () | no value
+036: 28: 8 | "a"                 *ast.BasicLit                  | value   : untyped string = "a" | constant
+037: 28:15 | m1                  *ast.Ident                     | var     : *main.Mesh | variable
+038: 28:19 | m2                  *ast.Ident                     | var     : *main.Mesh | variable
+039: 30: 1 | OnKey               *ast.Ident                     | value   : func(a []string, b []string, fn func(key string)) | value
+040: 30: 1 | OnKey ["a"], nil, key => {
+} *ast.CallExpr                  | void    : () | no value
+041: 30: 8 | "a"                 *ast.BasicLit                  | value   : untyped string = "a" | constant
+042: 30:14 | nil                 *ast.Ident                     | nil     : untyped nil | value
+043: 32: 1 | OnKey               *ast.Ident                     | value   : func(x int, y int) | value
+044: 32: 1 | OnKey 100, 200      *ast.CallExpr                  | void    : () | no value
+045: 32: 7 | 100                 *ast.BasicLit                  | value   : untyped int = 100 | constant
+046: 32:12 | 200                 *ast.BasicLit                  | value   : untyped int = 200 | constant
+047: 33: 1 | OnKey               *ast.Ident                     | value   : func(a string, b string, fn ...func(x int) int) | value
+048: 33: 1 | OnKey "a", "b", x => x * x, x => {
+	return x * 2
+} *ast.CallExpr                  | void    : () | no value
+049: 33: 7 | "a"                 *ast.BasicLit                  | value   : untyped string = "a" | constant
+050: 33:12 | "b"                 *ast.BasicLit                  | value   : untyped string = "b" | constant
+051: 33:22 | x                   *ast.Ident                     | var     : int | variable
+052: 33:22 | x * x               *ast.BinaryExpr                | value   : int | value
+053: 33:26 | x                   *ast.Ident                     | var     : int | variable
+054: 34: 9 | x                   *ast.Ident                     | var     : int | variable
+055: 34: 9 | x * 2               *ast.BinaryExpr                | value   : int | value
+056: 34:13 | 2                   *ast.BasicLit                  | value   : untyped int = 2 | constant
+057: 36: 1 | OnKey               *ast.Ident                     | value   : func(a string, b string, v ...int) | value
+058: 36: 1 | OnKey "a", "b", 1, 2, 3 *ast.CallExpr                  | void    : () | no value
+059: 36: 7 | "a"                 *ast.BasicLit                  | value   : untyped string = "a" | constant
+060: 36:12 | "b"                 *ast.BasicLit                  | value   : untyped string = "b" | constant
+061: 36:17 | 1                   *ast.BasicLit                  | value   : untyped int = 1 | constant
+062: 36:20 | 2                   *ast.BasicLit                  | value   : untyped int = 2 | constant
+063: 36:23 | 3                   *ast.BasicLit                  | value   : untyped int = 3 | constant
+064: 37: 1 | OnKey               *ast.Ident                     | value   : func(a string, b string, v ...int) | value
+065: 37: 1 | OnKey("a", "b", [1, 2, 3]...) *ast.CallExpr                  | void    : () | no value
+066: 37: 7 | "a"                 *ast.BasicLit                  | value   : untyped string = "a" | constant
+067: 37:12 | "b"                 *ast.BasicLit                  | value   : untyped string = "b" | constant
+068: 37:18 | 1                   *ast.BasicLit                  | value   : untyped int = 1 | constant
+069: 37:21 | 2                   *ast.BasicLit                  | value   : untyped int = 2 | constant
+070: 37:24 | 3                   *ast.BasicLit                  | value   : untyped int = 3 | constant
+== defs ==
+000:  2: 6 | Mesh                | type main.Mesh struct{}
+001:  5: 7 | p                   | var p *main.Mesh
+002:  5:16 | Name                | func (*main.Mesh).Name() string
+003: 10: 2 | m1                  | var main.m1 *main.Mesh
+004: 11: 2 | m2                  | var main.m2 *main.Mesh
+005: 14: 1 | main                | func main.main()
+006: 16:16 | key                 | var key string
+007: 20:14 | key                 | var key string
+008: 24:17 | key                 | var key main.Mesher
+009: 26:21 | key                 | var key string
+010: 28:24 | key                 | var key string
+011: 30:19 | key                 | var key string
+012: 33:17 | x                   | var x int
+013: 33:29 | x                   | var x int
+== uses ==
+000:  5:10 | Mesh                | type main.Mesh struct{}
+001:  5:23 | string              | type string
+002: 10: 8 | Mesh                | type main.Mesh struct{}
+003: 11: 8 | Mesh                | type main.Mesh struct{}
+004: 14: 1 | OnKey               | func main.OnKey__0(a string, fn func())
+005: 16: 1 | OnKey               | func main.OnKey__1(a string, fn func(key string))
+006: 18: 1 | OnKey               | func main.OnKey__2(a []string, fn func())
+007: 20: 1 | OnKey               | func main.OnKey__3(a []string, fn func(key string))
+008: 22: 1 | OnKey               | func main.OnKey__4(a []main.Mesher, fn func())
+009: 22: 8 | m1                  | var main.m1 *main.Mesh
+010: 22:12 | m2                  | var main.m2 *main.Mesh
+011: 24: 1 | OnKey               | func main.OnKey__5(a []main.Mesher, fn func(key main.Mesher))
+012: 24: 8 | m1                  | var main.m1 *main.Mesh
+013: 24:12 | m2                  | var main.m2 *main.Mesh
+014: 26: 1 | OnKey               | func main.OnKey__6(a []string, b []string, fn func(key string))
+015: 28: 1 | OnKey               | func main.OnKey__7(a []string, b []main.Mesher, fn func(key string))
+016: 28:15 | m1                  | var main.m1 *main.Mesh
+017: 28:19 | m2                  | var main.m2 *main.Mesh
+018: 30: 1 | OnKey               | func main.OnKey__6(a []string, b []string, fn func(key string))
+019: 30:14 | nil                 | nil
+020: 32: 1 | OnKey               | func main.OnKey__8(x int, y int)
+021: 33: 1 | OnKey               | func main.OnKey__9(a string, b string, fn ...func(x int) int)
+022: 33:22 | x                   | var x int
+023: 33:26 | x                   | var x int
+024: 34: 9 | x                   | var x int
+025: 36: 1 | OnKey               | func main.OnKey__a(a string, b string, v ...int)
+026: 37: 1 | OnKey               | func main.OnKey__a(a string, b string, v ...int)`)
+}
+
+func TestMixedOverload2(t *testing.T) {
+	testGopInfo(t, `
+type Mesh struct {
+}
+
+func (p *Mesh) Name() string {
+	return "hello"
+}
+
+var (
+	m1 = &Mesh{}
+	m2 = &Mesh{}
+)
+
+n := &N{}
+n.onKey "hello", => {
+}
+n.onKey "hello", key => {
+}
+n.onKey ["1"], => {
+}
+n.onKey ["2"], key => {
+}
+n.onKey [m1, m2], => {
+}
+n.onKey [m1, m2], key => {
+}
+n.onKey ["a"], ["b"], key => {
+}
+n.onKey ["a"], [m1, m2], key => {
+}
+n.onKey ["a"], nil, key => {
+}
+n.onKey 100, 200
+`, `
+package main
+
+type Mesher interface {
+	Name() string
+}
+
+type N struct {
+}
+
+func (m *N) OnKey__0(a string, fn func()) {
+}
+
+func (m *N) OnKey__1(a string, fn func(key string)) {
+}
+
+func (m *N) OnKey__2(a []string, fn func()) {
+}
+
+func (m *N) OnKey__3(a []string, fn func(key string)) {
+}
+
+func (m *N) OnKey__4(a []Mesher, fn func()) {
+}
+
+func (m *N) OnKey__5(a []Mesher, fn func(key Mesher)) {
+}
+
+func (m *N) OnKey__6(a []string, b []string, fn func(key string)) {
+}
+
+func (m *N) OnKey__7(a []string, b []Mesher, fn func(key string)) {
+}
+
+func (m *N) OnKey__8(x int, y int) {
+}
+
+
+func OnKey__0(a string, fn func()) {
+}
+
+func OnKey__1(a string, fn func(key string)) {
+}
+
+func OnKey__2(a []string, fn func()) {
+}
+
+func OnKey__3(a []string, fn func(key string)) {
+}
+
+func OnKey__4(a []Mesher, fn func()) {
+}
+
+func OnKey__5(a []Mesher, fn func(key Mesher)) {
+}
+
+func OnKey__6(a []string, b []string, fn func(key string)) {
+}
+
+func OnKey__7(a []string, b []Mesher, fn func(key string)) {
+}
+
+func OnKey__8(x int, y int) {
+}
+
+func OnKey__9(a, b string, fn ...func(x int) int) {
+}
+
+func OnKey__a(a, b string, v ...int) {
+}
+`, `== types ==
+000:  2:11 | struct {
+}          *ast.StructType                | type    : struct{} | type
+001:  5:10 | Mesh                *ast.Ident                     | type    : main.Mesh | type
+002:  5:23 | string              *ast.Ident                     | type    : string | type
+003:  6: 9 | "hello"             *ast.BasicLit                  | value   : untyped string = "hello" | constant
+004: 10: 7 | &Mesh{}             *ast.UnaryExpr                 | value   : *main.Mesh | value
+005: 10: 8 | Mesh                *ast.Ident                     | type    : main.Mesh | type
+006: 10: 8 | Mesh{}              *ast.CompositeLit              | value   : main.Mesh | value
+007: 11: 7 | &Mesh{}             *ast.UnaryExpr                 | value   : *main.Mesh | value
+008: 11: 8 | Mesh                *ast.Ident                     | type    : main.Mesh | type
+009: 11: 8 | Mesh{}              *ast.CompositeLit              | value   : main.Mesh | value
+010: 14: 6 | &N{}                *ast.UnaryExpr                 | value   : *main.N | value
+011: 14: 7 | N                   *ast.Ident                     | type    : main.N | type
+012: 14: 7 | N{}                 *ast.CompositeLit              | value   : main.N | value
+013: 15: 1 | n                   *ast.Ident                     | var     : *main.N | variable
+014: 15: 1 | n.onKey             *ast.SelectorExpr              | value   : func(a string, fn func()) | value
+015: 15: 1 | n.onKey "hello", => {
+} *ast.CallExpr                  | void    : () | no value
+016: 15: 9 | "hello"             *ast.BasicLit                  | value   : untyped string = "hello" | constant
+017: 17: 1 | n                   *ast.Ident                     | var     : *main.N | variable
+018: 17: 1 | n.onKey             *ast.SelectorExpr              | value   : func(a string, fn func(key string)) | value
+019: 17: 1 | n.onKey "hello", key => {
+} *ast.CallExpr                  | void    : () | no value
+020: 17: 9 | "hello"             *ast.BasicLit                  | value   : untyped string = "hello" | constant
+021: 19: 1 | n                   *ast.Ident                     | var     : *main.N | variable
+022: 19: 1 | n.onKey             *ast.SelectorExpr              | value   : func(a []string, fn func()) | value
+023: 19: 1 | n.onKey ["1"], => {
+} *ast.CallExpr                  | void    : () | no value
+024: 19:10 | "1"                 *ast.BasicLit                  | value   : untyped string = "1" | constant
+025: 21: 1 | n                   *ast.Ident                     | var     : *main.N | variable
+026: 21: 1 | n.onKey             *ast.SelectorExpr              | value   : func(a []string, fn func(key string)) | value
+027: 21: 1 | n.onKey ["2"], key => {
+} *ast.CallExpr                  | void    : () | no value
+028: 21:10 | "2"                 *ast.BasicLit                  | value   : untyped string = "2" | constant
+029: 23: 1 | n                   *ast.Ident                     | var     : *main.N | variable
+030: 23: 1 | n.onKey             *ast.SelectorExpr              | value   : func(a []main.Mesher, fn func()) | value
+031: 23: 1 | n.onKey [m1, m2], => {
+} *ast.CallExpr                  | void    : () | no value
+032: 23:10 | m1                  *ast.Ident                     | var     : *main.Mesh | variable
+033: 23:14 | m2                  *ast.Ident                     | var     : *main.Mesh | variable
+034: 25: 1 | n                   *ast.Ident                     | var     : *main.N | variable
+035: 25: 1 | n.onKey             *ast.SelectorExpr              | value   : func(a []main.Mesher, fn func(key main.Mesher)) | value
+036: 25: 1 | n.onKey [m1, m2], key => {
+} *ast.CallExpr                  | void    : () | no value
+037: 25:10 | m1                  *ast.Ident                     | var     : *main.Mesh | variable
+038: 25:14 | m2                  *ast.Ident                     | var     : *main.Mesh | variable
+039: 27: 1 | n                   *ast.Ident                     | var     : *main.N | variable
+040: 27: 1 | n.onKey             *ast.SelectorExpr              | value   : func(a []string, b []string, fn func(key string)) | value
+041: 27: 1 | n.onKey ["a"], ["b"], key => {
+} *ast.CallExpr                  | void    : () | no value
+042: 27:10 | "a"                 *ast.BasicLit                  | value   : untyped string = "a" | constant
+043: 27:17 | "b"                 *ast.BasicLit                  | value   : untyped string = "b" | constant
+044: 29: 1 | n                   *ast.Ident                     | var     : *main.N | variable
+045: 29: 1 | n.onKey             *ast.SelectorExpr              | value   : func(a []string, b []main.Mesher, fn func(key string)) | value
+046: 29: 1 | n.onKey ["a"], [m1, m2], key => {
+} *ast.CallExpr                  | void    : () | no value
+047: 29:10 | "a"                 *ast.BasicLit                  | value   : untyped string = "a" | constant
+048: 29:17 | m1                  *ast.Ident                     | var     : *main.Mesh | variable
+049: 29:21 | m2                  *ast.Ident                     | var     : *main.Mesh | variable
+050: 31: 1 | n                   *ast.Ident                     | var     : *main.N | variable
+051: 31: 1 | n.onKey             *ast.SelectorExpr              | value   : func(a []string, b []string, fn func(key string)) | value
+052: 31: 1 | n.onKey ["a"], nil, key => {
+} *ast.CallExpr                  | void    : () | no value
+053: 31:10 | "a"                 *ast.BasicLit                  | value   : untyped string = "a" | constant
+054: 31:16 | nil                 *ast.Ident                     | nil     : untyped nil | value
+055: 33: 1 | n                   *ast.Ident                     | var     : *main.N | variable
+056: 33: 1 | n.onKey             *ast.SelectorExpr              | value   : func(x int, y int) | value
+057: 33: 1 | n.onKey 100, 200    *ast.CallExpr                  | void    : () | no value
+058: 33: 9 | 100                 *ast.BasicLit                  | value   : untyped int = 100 | constant
+059: 33:14 | 200                 *ast.BasicLit                  | value   : untyped int = 200 | constant
+== defs ==
+000:  2: 6 | Mesh                | type main.Mesh struct{}
+001:  5: 7 | p                   | var p *main.Mesh
+002:  5:16 | Name                | func (*main.Mesh).Name() string
+003: 10: 2 | m1                  | var main.m1 *main.Mesh
+004: 11: 2 | m2                  | var main.m2 *main.Mesh
+005: 14: 1 | main                | func main.main()
+006: 14: 1 | n                   | var n *main.N
+007: 17:18 | key                 | var key string
+008: 21:16 | key                 | var key string
+009: 25:19 | key                 | var key main.Mesher
+010: 27:23 | key                 | var key string
+011: 29:26 | key                 | var key string
+012: 31:21 | key                 | var key string
+== uses ==
+000:  5:10 | Mesh                | type main.Mesh struct{}
+001:  5:23 | string              | type string
+002: 10: 8 | Mesh                | type main.Mesh struct{}
+003: 11: 8 | Mesh                | type main.Mesh struct{}
+004: 14: 7 | N                   | type main.N struct{}
+005: 15: 1 | n                   | var n *main.N
+006: 15: 3 | onKey               | func (*main.N).OnKey__0(a string, fn func())
+007: 17: 1 | n                   | var n *main.N
+008: 17: 3 | onKey               | func (*main.N).OnKey__1(a string, fn func(key string))
+009: 19: 1 | n                   | var n *main.N
+010: 19: 3 | onKey               | func (*main.N).OnKey__2(a []string, fn func())
+011: 21: 1 | n                   | var n *main.N
+012: 21: 3 | onKey               | func (*main.N).OnKey__3(a []string, fn func(key string))
+013: 23: 1 | n                   | var n *main.N
+014: 23: 3 | onKey               | func (*main.N).OnKey__4(a []main.Mesher, fn func())
+015: 23:10 | m1                  | var main.m1 *main.Mesh
+016: 23:14 | m2                  | var main.m2 *main.Mesh
+017: 25: 1 | n                   | var n *main.N
+018: 25: 3 | onKey               | func (*main.N).OnKey__5(a []main.Mesher, fn func(key main.Mesher))
+019: 25:10 | m1                  | var main.m1 *main.Mesh
+020: 25:14 | m2                  | var main.m2 *main.Mesh
+021: 27: 1 | n                   | var n *main.N
+022: 27: 3 | onKey               | func (*main.N).OnKey__6(a []string, b []string, fn func(key string))
+023: 29: 1 | n                   | var n *main.N
+024: 29: 3 | onKey               | func (*main.N).OnKey__7(a []string, b []main.Mesher, fn func(key string))
+025: 29:17 | m1                  | var main.m1 *main.Mesh
+026: 29:21 | m2                  | var main.m2 *main.Mesh
+027: 31: 1 | n                   | var n *main.N
+028: 31: 3 | onKey               | func (*main.N).OnKey__6(a []string, b []string, fn func(key string))
+029: 31:16 | nil                 | nil
+030: 33: 1 | n                   | var n *main.N
+031: 33: 3 | onKey               | func (*main.N).OnKey__8(x int, y int)`)
+}