ruff/crates/ty_python_semantic/resources/mdtest/call
Dhruv Manilawala c7e020df6b
[ty] Filter overloads based on Any / Unknown (#18607)
## 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.
2025-06-17 15:35:09 +05:30
..
annotation.md ty_python_semantic: add union type context to function call type errors 2025-05-09 13:40:51 -04:00
builtins.md [ty] Understand homogeneous tuple annotations (#17998) 2025-05-12 22:02:25 -04:00
callable_instance.md ty_python_semantic: add union type context to function call type errors 2025-05-09 13:40:51 -04:00
constructor.md [ty] Rename call-possibly-unbound-method to possibly-unbound-implicit-call (#18017) 2025-05-22 15:25:51 +00:00
dunder.md put similar dunder-call tests next to each other (#18343) 2025-05-27 12:16:41 -07:00
function.md ty_python_semantic: add union type context to function call type errors 2025-05-09 13:40:51 -04:00
getattr_static.md ty_python_semantic: add union type context to function call type errors 2025-05-09 13:40:51 -04:00
invalid_syntax.md ty_python_semantic: add union type context to function call type errors 2025-05-09 13:40:51 -04:00
methods.md ty_python_semantic: add union type context to function call type errors 2025-05-09 13:40:51 -04:00
never.md Rename Red Knot (#17820) 2025-05-03 19:49:15 +02:00
overloads.md [ty] Filter overloads based on Any / Unknown (#18607) 2025-06-17 15:35:09 +05:30
str_startswith.md Rename Red Knot (#17820) 2025-05-03 19:49:15 +02:00
subclass_of.md [ty] Include synthesized arguments in displayed counts for too-many-positional-arguments (#18098) 2025-05-14 22:51:23 -04:00
union.md ty_python_semantic: add union type context to function call type errors 2025-05-09 13:40:51 -04:00