Skip to content

Commit 7ea773d

Browse files
authored
[ty] Argument type expansion for overload call evaluation (#18382)
## Summary Part of astral-sh/ty#104, closes: astral-sh/ty#468 This PR implements the argument type expansion which is step 3 of the overload call evaluation algorithm. Specifically, this step needs to be taken if type checking resolves to no matching overload and there are argument types that can be expanded. ## Test Plan Add new test cases. ## Ecosystem analysis This PR removes 174 `no-matching-overload` false positives -- I looked at a lot of them and they all are false positives. One thing that I'm not able to understand is that in https://github.com/sphinx-doc/sphinx/blob/2b7e3adf27c158305acca9b5e4d0d93d3e4c6f09/sphinx/ext/autodoc/preserve_defaults.py#L179 the inferred type of `value` is `str | None` by ty and Pyright, which is correct, but it's only ty that raises `invalid-argument-type` error while Pyright doesn't. The constructor method of `DefaultValue` has declared type of `str` which is invalid. There are few cases of false positives resulting due to the fact that ty doesn't implement narrowing on attribute expressions.
1 parent 0079cc6 commit 7ea773d

File tree

3 files changed

+955
-25
lines changed

3 files changed

+955
-25
lines changed

0 commit comments

Comments
 (0)