gop
gop copied to clipboard
Go generic type methods does not recognize overload
The following program sample.gop triggers an unexpected result
-- abc.go
// add a sample
package abc
const GopPackage = true
type M[T any] struct {
}
func (m *M[T]) Foo__0() {
}
func (m *M[T]) Foo__1(a string) {
}
func Bar__0() {
println("foo__0")
}
func Bar__1[T any](a T) {
println("foo__1", a)
}
-- main.gop
import "github.com/visualfc/demo/abc"
abc.bar "world" //build pass
var m abc.M[int]
m.foo "world" // build error
Expected result
build pass
Got
panic: ./main.gop:4:1: too many arguments in call to m.foo "world"
have (untyped string)
want ()
Gop Version
gop v1.1.5
Additional Notes
No response