[ty] Return all attribute definitions for goto definition#24332
Open
MichaReiser wants to merge 2 commits intomainfrom
Open
[ty] Return all attribute definitions for goto definition#24332MichaReiser wants to merge 2 commits intomainfrom
MichaReiser wants to merge 2 commits intomainfrom
Conversation
MichaReiser
commented
Mar 31, 2026
Comment on lines
+2622
to
+2629
| info[rename]: Rename symbol (found 5 locations) | ||
| --> main.py:4:13 | ||
| | | ||
| 2 | from lib import Foo | ||
| 3 | | ||
| 4 | print(Foo().my_property) | ||
| | ^^^^^^^^^^^ | ||
| 5 | Foo().my_property = 56 |
Member
Author
There was a problem hiding this comment.
This already worked before because rename tests if the definitions of the renamed symbol and the current symbol's definitions intersect. But I felt it's still worth adding a test for it.
Typing conformance resultsNo changes detected ✅Current numbersThe percentage of diagnostics emitted that were expected errors held steady at 86.61%. The percentage of expected errors that received a diagnostic held steady at 81.56%. The number of fully passing files held steady at 70/132. |
Memory usage reportMemory usage unchanged ✅ |
|
| Lint rule | Added | Removed | Changed |
|---|---|---|---|
invalid-await |
0 | 40 | 0 |
invalid-return-type |
0 | 1 | 0 |
| Total | 0 | 41 | 0 |
Changes in flaky projects detected. Raw diff output excludes flaky projects; see the HTML report for details.
sharkdp
approved these changes
Apr 1, 2026
Comment on lines
+2074
to
+2077
| 3 | a: str | ||
| | - | ||
| 4 | a: str | ||
| | - |
Contributor
There was a problem hiding this comment.
Hm, interesting. It seems a bit strange to me, but as you pointed out, this is now consistent with what we do for non-class scopes. And it seems like the right choice for renaming, and of course for properties.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Instead of only returning the first definition, return all definitions in the same scope.
This ensures that ty returns all definitions of
xin the following example instead of just the first:This matches the behavior of standalone variables:
also shows both definitions of
xTest Plan
Added tests