Skip to content

[ty] Add redeclaration LSP tests#21812

Merged
MichaReiser merged 2 commits intomainfrom
micha/redeclaration-tests
Dec 5, 2025
Merged

[ty] Add redeclaration LSP tests#21812
MichaReiser merged 2 commits intomainfrom
micha/redeclaration-tests

Conversation

@MichaReiser
Copy link
Member

Summary

Add tests that demonstrate how ty handles redeclarations:

a: str = "test"

a: int = 10

print(a<CURSOR>)

a: bool = True

Curious to here if my expectations align with everyon else's.

Basically, my thinking is that a: int introduces a new declaration and features like:

  • find references
  • go to definition
  • doc highlighting
  • rename
  • ...

should all ignore the a: str declaration, because it's a separate declaration.

Test Plan

Added tests

@MichaReiser MichaReiser added the testing Related to testing Ruff itself label Dec 5, 2025
@MichaReiser MichaReiser requested a review from carljm as a code owner December 5, 2025 13:10
@MichaReiser MichaReiser added the ty Multi-file analysis & type inference label Dec 5, 2025
@MichaReiser MichaReiser added testing Related to testing Ruff itself ty Multi-file analysis & type inference labels Dec 5, 2025
@AlexWaygood AlexWaygood added the server Related to the LSP server label Dec 5, 2025
@astral-sh-bot
Copy link

astral-sh-bot bot commented Dec 5, 2025

Diagnostic diff on typing conformance tests

No changes detected when running ty on typing conformance tests ✅

@astral-sh-bot
Copy link

astral-sh-bot bot commented Dec 5, 2025

mypy_primer results

No ecosystem changes detected ✅

No memory usage changes detected ✅

Copy link
Member

@AlexWaygood AlexWaygood left a comment

Choose a reason for hiding this comment

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

I agree with all of these!

@MichaReiser MichaReiser enabled auto-merge (squash) December 5, 2025 17:58
@MichaReiser MichaReiser merged commit b2fb421 into main Dec 5, 2025
40 checks passed
@MichaReiser MichaReiser deleted the micha/redeclaration-tests branch December 5, 2025 18:02
dcreager added a commit that referenced this pull request Dec 5, 2025
* origin/main:
  [ty] Allow `tuple[Any, ...]` to assign to `tuple[int, *tuple[int, ...]]` (#21803)
  [ty] Support renaming import aliases (#21792)
  [ty] Add redeclaration LSP tests (#21812)
  [ty] more detailed description of "Size limit on unions of literals" in mdtest (#21804)
  [ty] Complete support for `ParamSpec` (#21445)
  [ty] Update benchmark dependencies (#21815)
dcreager added a commit that referenced this pull request Dec 7, 2025
* origin/main:
  [ty] Add test case for fixed panic (#21832)
  [ty] Avoid double-analyzing tuple in `Final` subscript (#21828)
  [flake8-bandit] Fix false positive when using non-standard `CSafeLoader` path (S506). (#21830)
  Add minimal-size build profile (#21826)
  [ty] Allow `tuple[Any, ...]` to assign to `tuple[int, *tuple[int, ...]]` (#21803)
  [ty] Support renaming import aliases (#21792)
  [ty] Add redeclaration LSP tests (#21812)
  [ty] more detailed description of "Size limit on unions of literals" in mdtest (#21804)
  [ty] Complete support for `ParamSpec` (#21445)
  [ty] Update benchmark dependencies (#21815)
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 testing Related to testing Ruff itself ty Multi-file analysis & type inference

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants