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

x/tools/gopls: canonicalize references to instantiated objects #51672

Closed
findleyr opened this issue Mar 14, 2022 · 2 comments
Closed

x/tools/gopls: canonicalize references to instantiated objects #51672

findleyr opened this issue Mar 14, 2022 · 2 comments
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@findleyr
Copy link
Contributor

When finding references or doing a rename on an instantiated method or field, gopls uses pointer object identity, which is unreliable for instantiated objects and can lead to partial results.

We need to canonicalize the object identity, finding the corresponding object on the generic type declaration.

@gopherbot gopherbot added Tools This label describes issues relating to any tools in the x/tools repository. gopls Issues related to the Go language server, gopls. labels Mar 14, 2022
@gopherbot gopherbot added this to the Unreleased milestone Mar 14, 2022
@findleyr findleyr self-assigned this Mar 14, 2022
@findleyr findleyr modified the milestones: Unreleased, gopls/v0.8.1 Mar 14, 2022
@gopherbot
Copy link
Contributor

Change https://go.dev/cl/392480 mentions this issue: internal/lsp/source: canonicalize objects in reference/rename requests

@gopherbot
Copy link
Contributor

Change https://go.dev/cl/392914 mentions this issue: internal/lsp/source: canonicalize objects in reference/rename requests

gopherbot pushed a commit to golang/tools that referenced this issue Mar 15, 2022
With generics, instantiated object may have differing pointer
identities. Fix references/rename requests for instantiated
methods/fields by using a canonical object identity of (pos, pkg, name).

(Also update the go.mod to add back the replace directive, so that tests
may pass at this CL)

Fixes golang/go#51672

Change-Id: I0021ca562b8a74dadb616cf6864cb0bdd0165cc3
Reviewed-on: https://go-review.googlesource.com/c/tools/+/392480
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
(cherry picked from commit 6799a7a)
Reviewed-on: https://go-review.googlesource.com/c/tools/+/392914
@golang golang locked and limited conversation to collaborators Jun 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

2 participants