[tools] gopls/internal/golang: normalize instantiated fields before rename

0 views
Skip to first unread message

Madeline Kalil (Gerrit)

unread,
Aug 10, 2026, 5:09:33 PM (13 hours ago) Aug 10
to shuang cui, goph...@pubsubhelper.golang.org, golang-...@googlegroups.com, Dmitri Shuralyov, Dmitri Shuralyov, golang...@luci-project-accounts.iam.gserviceaccount.com, Alex Putman, golang-co...@googlegroups.com

Madeline Kalil submitted the change

Change information

Commit message:
gopls/internal/golang: normalize instantiated fields before rename

When a rename is initiated at a field selection on an instantiated
generic type, go/types reports a synthetic *types.Var. The rename
operation consequently updates other instantiated uses but misses the
original field declaration.

Normalize field targets to their origin before performing the rename.
This ensures that the declaration, selector uses, and keyed composite
literals are updated together.

Add a marker test for a rename initiated at an instantiated field
selection.

Fixes golang/go#80542
Change-Id: I8cdd107e6f4de584879f896ebf27d3c823b87473
Reviewed-by: Dmitri Shuralyov <dmit...@google.com>
Reviewed-by: Madeline Kalil <mka...@google.com>
Files:
  • M gopls/internal/golang/rename.go
  • A gopls/internal/test/marker/testdata/rename/issue80542.txt
Change size: M
Delta: 2 files changed, 72 insertions(+), 2 deletions(-)
Branch: refs/heads/master
Submit Requirements:
Open in Gerrit
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: merged
Gerrit-Project: tools
Gerrit-Branch: master
Gerrit-Change-Id: I8cdd107e6f4de584879f896ebf27d3c823b87473
Gerrit-Change-Number: 804901
Gerrit-PatchSet: 3
Gerrit-Owner: shuang cui <imc...@gmail.com>
Gerrit-Reviewer: Alex Putman <apu...@golang.org>
Gerrit-Reviewer: Dmitri Shuralyov <dmit...@google.com>
Gerrit-Reviewer: Madeline Kalil <mka...@google.com>
Gerrit-Reviewer: shuang cui <imc...@gmail.com>
Gerrit-CC: Dmitri Shuralyov <dmit...@golang.org>
open
diffy
satisfied_requirement
Reply all
Reply to author
Forward
0 new messages