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

cmd/compile: could not import "package" (cannot import "package" (type parameter bound more than once), possibly version skew - reinstall package) [1.18 backport] #51847

Closed
gopherbot opened this issue Mar 21, 2022 · 3 comments
Labels
CherryPickApproved
Milestone

Comments

@gopherbot
Copy link

@gopherbot gopherbot commented Mar 21, 2022

@ianlancetaylor requested issue #51836 to be considered for backport to the next 1.18 minor release.

@gopherbot Please open backport to 1.18

This seems to be a compiler error on valid code.

@gopherbot
Copy link
Author

@gopherbot gopherbot commented Mar 22, 2022

Change https://go.dev/cl/394854 mentions this issue: cmd/compile/internal/importer: key tparams by Package instead of pkgname

@toothrot toothrot added the CherryPickApproved label Mar 23, 2022
@toothrot
Copy link
Contributor

@toothrot toothrot commented Mar 23, 2022

Approved. This is a serious issue with no workaround.

@gopherbot gopherbot removed the CherryPickCandidate label Mar 23, 2022
@gopherbot
Copy link
Author

@gopherbot gopherbot commented Apr 4, 2022

Closed by merging 69bc821 to release-branch.go1.18.

gopherbot pushed a commit that referenced this issue Apr 4, 2022
… 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 <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
(cherry picked from commit fd1b590)
Reviewed-on: https://go-review.googlesource.com/c/go/+/394854
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CherryPickApproved
Projects
None yet
Development

No branches or pull requests

2 participants