[ty] Avoid unnecessary argument type expansion by dhruvmanila · Pull Request #19999 · astral-sh/ruff (original) (raw)
added performance
Potential performance improvement
Multi-file analysis & type inference
labels
dhruvmanila deleted the dhruv/avoid-argument-type-expansion branch
dcreager added a commit that referenced this pull request
- main:
[ty] Use
dedentin cursor tests (#20019) Fix rust feature activation (#20012) [ty] Avoid unnecessary argument type expansion (#19999) [ty] Add link for namespaces being partial (#20015)
second-ed pushed a commit to second-ed/ruff that referenced this pull request
Summary
Part of: astral-sh/ty#868
This PR adds a heuristic to avoid argument type expansion if it's going to eventually lead to no matching overload.
This is done by checking whether the non-expandable argument types are assignable to the corresponding annotated parameter type. If one of them is not assignable to all of the remaining overloads, then argument type expansion isn't going to help.
Test Plan
Add mdtest that would otherwise take a long time because of the number of arguments that it would need to expand (30).
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
[ Show hidden characters]({{ revealButtonHref }})