-
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: could not import "package" (cannot import "package" (type parameter bound more than once), possibly version skew - reinstall package) #51836
Comments
Related to #49893 |
Note that the problem the duplicate package name, Same for other variations ( |
@gopherbot Please open backport to 1.18 This seems to be a compiler error on valid code. |
Backport issue(s) opened: #51847 (for 1.18). Remember to create the cherry-pick CL(s) as soon as the patch is submitted to master, according to https://go.dev/wiki/MinorReleases. |
I can take a look at this. Presumably the problem is that the key in this index is incorrect, and doesn't differentiate the two packages: |
Change https://go.dev/cl/394219 mentions this issue: |
Change https://go.dev/cl/394854 mentions this issue: |
… Package instead of pkgname The importer type param index used package name as type parameter key, causing type parameters to be reused/overwritten if two packages in the import graph had the same combination of (package name, declaration name, type parameter name). Fix this by instead using the *Package in the key. Note: -G=3 was added to typeparam/issue51836.go, as it is necessary for 1.18 but not for tip. For #51836 Fixes #51847 Change-Id: I881ceaf3cf7c1ab4e0835962350feb552e79b233 Reviewed-on: https://go-review.googlesource.com/c/go/+/394219 Trust: Robert Findley <[email protected]> Run-TryBot: Robert Findley <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: Robert Griesemer <[email protected]> (cherry picked from commit fd1b590) Reviewed-on: https://go-review.googlesource.com/c/go/+/394854
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
This is the latest release.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
https://go.dev/play/p/oIoBIbuJ4n8
What did you expect to see?
It compile correctly.
What did you see instead?
Compiler error.
The text was updated successfully, but these errors were encountered: