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

Rename Symbol skips unreachable code #2431

Closed
xavdid opened this issue Mar 3, 2022 · 2 comments
Closed

Rename Symbol skips unreachable code #2431

xavdid opened this issue Mar 3, 2022 · 2 comments
Labels
bug Something isn't working fixed in next version (main) A fix has been implemented and will appear in an upcoming version

Comments

@xavdid
Copy link

xavdid commented Mar 3, 2022

Environment data

  • Language Server version: 2022.2.1
  • OS and version: darwin arm64
  • Python version (and distribution if applicable, e.g. Anaconda):
  • python.analysis.indexing: null
  • python.analysis.typeCheckingMode: basic

Expected behaviour

All references to the same symbol are renamed, even those that are otherwise unreachable.

Actual behaviour

Unreachable symbols aren't renamed. If the line causing code to be unreachable is removed after rename, then you have undefined variables caused by the renamer.

Apologies in advance if this is working as intended, it just seemed like odd behavior to me.

Logs

Python Language Server Log

(there was no data on my clipboard); manually fetched logs didn't seem relevant. Happy to include them if needed.

Code Snippet / Additional information

Renaming a -> b doesn't rename unreachable symbol

def f():
    a = 1
    a += 2
    return a

    a += 4 # isn't renamed
@github-actions github-actions bot added the triage label Mar 3, 2022
@erictraut
Copy link
Contributor

Thanks for the bug report. This will be fixed in the next release.

@erictraut erictraut added bug Something isn't working fixed in next version (main) A fix has been implemented and will appear in an upcoming version and removed triage labels Mar 3, 2022
@bschnurr
Copy link
Member

bschnurr commented Mar 9, 2022

This issue has been fixed in version 2022.3.1, which we've just released. You can find the changelog here: CHANGELOG.md

@bschnurr bschnurr closed this as completed Mar 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fixed in next version (main) A fix has been implemented and will appear in an upcoming version
Projects
None yet
Development

No branches or pull requests

3 participants