Skip to content

fix(61258): Renaming namespace with const enum doesn't update enum references #61263

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

Merged
merged 1 commit into from
Apr 24, 2025

Conversation

a-tarasyuk
Copy link
Contributor

Fixes #61258

@typescript-bot typescript-bot added the For Backlog Bug PRs that fix a backlog bug label Mar 17, 2025
@a-tarasyuk a-tarasyuk requested a review from jakebailey March 17, 2025 21:16
@jakebailey
Copy link
Member

I finally went to check this, and I think there's a simpler solution here; in rename, getReferencedSymbolsForSymbol is called to get everything that should be renamed. But, it does this:

const searchMeaning = node ? getIntersectingMeaningFromDeclarations(node, symbol) : SemanticMeaning.All;

The upshot of this is that what gets renamed for this symbol is filtered by the meaning, even if the symbols are the same.

I think that doing this (undoing everything else in the PR) works:

const searchMeaning = node && options.use !== FindReferencesUse.Rename ? getIntersectingMeaningFromDeclarations(node, symbol) : SemanticMeaning.All;

Basically, in renames, find all references regardless of meaning.

This works for the test case you added, but does also change one existing baseline in a way that I think is positive? Or at least, more consistent to my eye.

@github-project-automation github-project-automation bot moved this from Not started to Needs merge in PR Backlog Apr 24, 2025
@jakebailey jakebailey merged commit 11e7932 into microsoft:main Apr 24, 2025
32 checks passed
@github-project-automation github-project-automation bot moved this from Needs merge to Done in PR Backlog Apr 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
For Backlog Bug PRs that fix a backlog bug
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Renaming namespace with const enum doesn't update enum references
3 participants