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: //go:build file version ignored when calling generic fn which has related type params (reproduces with 1.21 and 1.20, not at tip) [1.21 backport] #65053

Closed
gopherbot opened this issue Jan 10, 2024 · 2 comments
Labels
CherryPickApproved Used during the release process for point releases compiler/runtime Issues related to the Go compiler and/or runtime.
Milestone

Comments

@gopherbot
Copy link

@griesemer requested issue #64759 to be considered for backport to the next 1.21 minor release.

@gopherbot Please consider this for backport to 1.21 and 1.20, this causes a compilation failure for code that chooses to select a future Go version in one of its source files.

@gopherbot gopherbot added the CherryPickCandidate Used during the release process for point releases label Jan 10, 2024
@gopherbot gopherbot added the compiler/runtime Issues related to the Go compiler and/or runtime. label Jan 10, 2024
@gopherbot gopherbot added this to the Go1.21.7 milestone Jan 10, 2024
@gopherbot
Copy link
Author

Change https://go.dev/cl/555415 mentions this issue: [release-branch.go1.21] go/types, types2: don't lose position info of interface embeddings

@cherrymui cherrymui added the CherryPickApproved Used during the release process for point releases label Jan 24, 2024
@gopherbot gopherbot removed the CherryPickCandidate Used during the release process for point releases label Jan 24, 2024
@gopherbot
Copy link
Author

Closed by merging 00f974e to release-branch.go1.21.

gopherbot pushed a commit that referenced this issue Jan 25, 2024
… interface embeddings

Accurate position information for embedded types in interfaces is
crucial to identify the corresponding source file, and with that
the Go language version associated with that file. (The position
information is also important for proper error messages.)

Before this CL, the position information for embedded types was
discarded after type set computation, in the assumption that it
was not needed anymore. However, substitutions that update the
interface may lead to repeated type set computations which then
won't have the correct position information.

This CL does preserve the position information for embedded
types until the end of type checking (cleanup phase), and also
copy the position information during a substitution of the
interface.

The respective bug (#64759) doesn't seem to appear in 1.22 (most
likely because it's hidden by some of the changes made with respect
to the file version logic), but the existing code is still wrong.
The backport of this code to 1.21 and 1.20 fixes the issue in those
releases.

For #64759.
Fixes #65053.

Change-Id: I80f4004c9d79cb02eac6739c324c477706615102
Reviewed-on: https://go-review.googlesource.com/c/go/+/555296
Run-TryBot: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/555415
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CherryPickApproved Used during the release process for point releases compiler/runtime Issues related to the Go compiler and/or runtime.
Projects
None yet
Development

No branches or pull requests

2 participants