mirror of
https://github.com/astral-sh/ruff.git
synced 2025-07-15 09:05:09 +00:00
![]() ## Summary Closes: astral-sh/ty#552 This PR adds support for step 5 of the overload call evaluation algorithm which specifies: > For all arguments, determine whether all possible materializations of the argument’s type are > assignable to the corresponding parameter type for each of the remaining overloads. If so, > eliminate all of the subsequent remaining overloads. The algorithm works in two parts: 1. Find out the participating parameter indexes. These are the parameters that aren't gradual equivalent to one or more parameter types at the same index in other overloads. 2. Loop over each overload and check whether that would be the _final_ overload for the argument types i.e., the remaining overloads will never be matched against these argument types For step 1, the participating parameter indexes are computed by just comparing whether all the parameter types at the corresponding index for all the overloads are **gradual equivalent**. The step 2 of the algorithm used is described in [this comment](https://github.com/astral-sh/ty/issues/552#issuecomment-2969165421). ## Test Plan Update the overload call tests. |
||
---|---|---|
.. | ||
annotation.md | ||
builtins.md | ||
callable_instance.md | ||
constructor.md | ||
dunder.md | ||
function.md | ||
getattr_static.md | ||
invalid_syntax.md | ||
methods.md | ||
never.md | ||
overloads.md | ||
str_startswith.md | ||
subclass_of.md | ||
union.md |