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

gopherbot opened this issue Mar 21, 2022 · 3 comments


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.

Copy link

@gopherbot gopherbot commented Mar 22, 2022

Change mentions this issue: cmd/compile/internal/importer: key tparams by Package instead of pkgname

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

@toothrot toothrot commented Mar 23, 2022

Approved. This is a serious issue with no workaround.

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

@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
Trust: Robert Findley <>
Run-TryBot: Robert Findley <>
TryBot-Result: Gopher Robot <>
Reviewed-by: Robert Griesemer <>
(cherry picked from commit fd1b590)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

No branches or pull requests

2 participants