Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Go generic type methods does not recognize overload #1396

Open
visualfc opened this issue Jul 14, 2023 · 0 comments
Open

Go generic type methods does not recognize overload #1396

visualfc opened this issue Jul 14, 2023 · 0 comments
Labels

Comments

@visualfc
Copy link
Member

visualfc commented Jul 14, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants