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

Renaming class property doesn't update structural pattern matching uses of the renamed property #6731

Open
reuben opened this issue Dec 4, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@reuben
Copy link

reuben commented Dec 4, 2024

Environment data

  • Pylance version: v2024.11.3
  • OS and version: macOS Sequoia 15.1.1 (24B91)
  • Python version: 3.10.15

Code Snippet

class Foo:
    prop: int


def process(f: Foo):
    match f:
        case Foo(prop=1):
            print("one")
        case Foo(prop=prop):
            print(f"other: {prop}")
        case _:
            print("default")


if __name__ == "__main__":
    f = Foo()
    f.prop = 1
    process(f)

Repro Steps

  1. Right click Foo.prop, click "Rename symbol" and name it something else, e.g. my_prop

Expected behavior

Destructuring pattern matching is updated from prop to my_prop. Program behavior is unchanged.

Actual behavior

Destructuring pattern matching is not affected, program behavior is silently modified (default case is reached).

Logs

...
@github-actions github-actions bot added the needs repro Issue has not been reproduced yet label Dec 4, 2024
@StellaHuang95 StellaHuang95 added bug Something isn't working and removed needs repro Issue has not been reproduced yet labels Dec 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants