-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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
cmd/compile: cannot import "package" (type parameter bound more than once) #49893
Comments
I'm looking at this, since it may relate to confusion with import/export, but @findleyr , you may also want to take a look when you get a chance, since the error happens in types2. Seems like we may somehow confused distinct type parameters during export/import across multiple packages. Problem goes away if the type params in definition of Ap2 are renamed (e.g. to A2/B2). |
Thanks for the repro. This should be a release blocker: there is something wrong with our type-parameter scoping. |
@danscales the error is coming from types2, but the bug must be in the importer. Type parameters are local to their function/type, and so must be bound only once. |
The bug relates to the type parameter B being specified in Ap1, but not actually being used in Ap1 (applies to Ap2 as well). Because B is not used, we are somehow referencing the wrong B during definition and then export. Doesn't always cause a visible problem, but sometimes does (as in this issue). |
Change https://golang.org/cl/368454 mentions this issue: |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (
go env
)?The Gotip Playground
What did you do?
https://gotipplay.golang.org/p/MFUJGGC_uWf
What did you expect to see?
Compiled without error
What did you see instead?
./prog.go:5:2: could not import tptest/option (cannot import "tptest/option" (type parameter bound more than once), possibly version skew - reinstall package)
The text was updated successfully, but these errors were encountered: