Skip to content

[ty] Include setters and deleters when renaming properties#22999

Merged
charliermarsh merged 2 commits intomainfrom
charlie/get
Feb 4, 2026
Merged

[ty] Include setters and deleters when renaming properties#22999
charliermarsh merged 2 commits intomainfrom
charlie/get

Conversation

@charliermarsh
Copy link
Member

Summary

Closes astral-sh/ty#1781.

@charliermarsh charliermarsh added server Related to the LSP server ty Multi-file analysis & type inference labels Jan 31, 2026
@charliermarsh charliermarsh marked this pull request as ready for review January 31, 2026 15:28
Copy link
Contributor

@carljm carljm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

// The second `my_func` definition should be renamed. The decorator reference
// is also found since both definitions share the same name in the same scope.
// Note: Ideally the decorator reference wouldn't be included since it semantically
// refers to the first `my_func`, but distinguishing shadowed bindings is a separate issue.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is too bad, since in this case it actually breaks the code. Do we have an issue open to track correct handling of shadowed bindings?

If the logic is really "same name in same scope", then why don't we also rename the def my_func above, which defines the same name in the same scope?

(Sorry if I'm asking a bunch of questions that are sort of orthogonal to this PR and maybe you aren't the right person to answer 😆 )

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(I refined the comment a bit... I'll also look into the issue.)

@charliermarsh charliermarsh enabled auto-merge (squash) February 4, 2026 06:04
@charliermarsh charliermarsh merged commit f7c2da2 into main Feb 4, 2026
43 of 44 checks passed
@charliermarsh charliermarsh deleted the charlie/get branch February 4, 2026 06:08
bxff pushed a commit to bxff/ruff that referenced this pull request Feb 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

server Related to the LSP server ty Multi-file analysis & type inference

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Server: renaming a property getter should also cause the setter and deleter to be renamed (if they're present)

2 participants