Skip to content

[ty] add more lsp tests for overloads#20148

Merged
Gankra merged 1 commit intomainfrom
gankra/test-over
Sep 2, 2025
Merged

[ty] add more lsp tests for overloads#20148
Gankra merged 1 commit intomainfrom
gankra/test-over

Conversation

@Gankra
Copy link
Contributor

@Gankra Gankra commented Aug 29, 2025

I decided to split out the addition of these tests from other PRs so that it's easier to follow changes to the LSP's function call handling. I'm not particularly concerned with whether the results produced by these tests are "good" or "bad" in this PR, I'm just establishing a baseline.

I decided to split out the addition of these tests from other PRs so
that it's easier to follow changes to the LSP's function call handling
@Gankra Gankra requested a review from carljm as a code owner August 29, 2025 03:22
@Gankra Gankra added the internal An internal refactor or improvement label Aug 29, 2025
@Gankra Gankra added the server Related to the LSP server label Aug 29, 2025
@Gankra Gankra requested a review from dcreager as a code owner August 29, 2025 03:22
@Gankra Gankra added the ty Multi-file analysis & type inference label Aug 29, 2025
@Gankra
Copy link
Contributor Author

Gankra commented Aug 29, 2025

(Each of the 4 files received a copy of the same 6 tests)

@github-actions
Copy link
Contributor

Diagnostic diff on typing conformance tests

No changes detected when running ty on typing conformance tests ✅

@github-actions
Copy link
Contributor

mypy_primer results

No ecosystem changes detected ✅
No memory usage changes detected ✅

Comment on lines +817 to +822
"mymodule.py",
r#"
def ab(a):
"""the real implementation!"""
"#,
)
Copy link
Member

Choose a reason for hiding this comment

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

Should this have the overloads defined so that the test asserts that goto definition goes to the correct overload? I'm fine with it not being present, I mainly want to understand the reasoning behind the test cases in this file as they all have defined only the implementation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm interesting, would you expect a .pyi and a .py to declare overloads? (they're purely type annotations right? there isn't an implementation to go to for an overload? or did I get myself mixed up)

Copy link
Member

Choose a reason for hiding this comment

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

Hmm, yeah that's a good point. It's not required for the overload definitions to be present in both runtime and stub files as they're mainly for typing purposes (as you've stated as well). So, I think my main question would be do we want to test the goto definition functionality by defining the overloads in the runtime file?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think ultimately goto-definition just has boring answers here, but it's worth making sure stub mapping doesn't get confused by the situation (that said it's possible we want like, 3 different variations of every one of these tests but... for now let's not).

@AlexWaygood AlexWaygood removed their request for review August 29, 2025 14:01
@Gankra Gankra merged commit f40a0b3 into main Sep 2, 2025
40 checks passed
@Gankra Gankra deleted the gankra/test-over branch September 2, 2025 14:38
second-ed pushed a commit to second-ed/ruff that referenced this pull request Sep 9, 2025
I decided to split out the addition of these tests from other PRs so
that it's easier to follow changes to the LSP's function call handling.
I'm not particularly concerned with whether the results produced by
these tests are "good" or "bad" in this PR, I'm just establishing a
baseline.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

internal An internal refactor or improvement 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.

2 participants