ruff/crates/ty_python_semantic/resources/mdtest
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
..
annotations [ty] Fix panics when pulling types for various special forms that have the wrong number of parameters (#18642) 2025-06-17 10:40:50 +01:00
assignment [ty] Add hint that PEP 604 union syntax is only available in 3.10+ (#18192) 2025-05-19 19:47:31 +02:00
binary [ty] Minor tweaks to "list all members" docs and tests (#18388) 2025-05-30 13:36:57 -04:00
boolean Revert "[ty] Better control flow for boolean expressions that are inside if (#18010)" (#18150) 2025-05-17 08:27:32 -04:00
boundness_declaredness Update class literal display to use <class 'Foo'> style (#17889) 2025-05-06 20:11:25 -04:00
call [ty] Filter overloads based on Any / Unknown (#18607) 2025-06-17 15:35:09 +05:30
class Update class literal display to use <class 'Foo'> style (#17889) 2025-05-06 20:11:25 -04:00
comparison [ty] Fix binary intersection comparison inference logic (#18266) 2025-05-23 12:55:17 +02:00
comprehensions
conditional
declaration
diagnostics [ty] Don't warn yield not in function when yield is in function (#18008) 2025-05-21 18:16:25 +02:00
directives [ty] Fix normalization of unions containing instances parameterized with unions (#18112) 2025-05-14 22:48:33 -04:00
doc ty_python_semantic: add union type context to function call type errors 2025-05-09 13:40:51 -04:00
exception [ty] support del statement and deletion of except handler names (#18593) 2025-06-12 07:44:42 -07:00
expression [ty] Treat lambda functions as instances of types.FunctionType (#18431) 2025-06-02 16:46:26 +01:00
function [ty] Add diagnosis for function with no return statement but with return type annotation (#18359) 2025-05-29 23:17:18 +00:00
generics [ty] Add meta-type tests for legavy TypeVars (#18453) 2025-06-04 07:44:44 +00:00
ide_support [ty] Minor tweaks to "list all members" docs and tests (#18388) 2025-05-30 13:36:57 -04:00
import [ty] Reachability constraints (#18621) 2025-06-17 09:24:28 +02:00
literal [ty] Understand classes that inherit from subscripted Protocol[] as generic (#17832) 2025-05-09 17:39:15 +01:00
loops
narrow [ty] basic narrowing on attribute and subscript expressions (#17643) 2025-06-17 11:07:46 +02:00
regression
scopes [ty] Add support for global __debug__ constant (#18540) 2025-06-10 06:48:59 +00:00
shadowing
snapshots [ty] Add hints to invalid-type-form for common mistakes (#18543) 2025-06-09 00:40:05 +01:00
stubs [ty] Do not carry the generic context of Protocol or Generic in the ClassBase enum (#17989) 2025-05-22 21:37:03 -04:00
subscript [ty] Do not carry the generic context of Protocol or Generic in the ClassBase enum (#17989) 2025-05-22 21:37:03 -04:00
suppressions
type_compendium [ty] allow T: Never as subtype of Never (#18687) 2025-06-16 17:46:17 +00:00
type_of Update class literal display to use <class 'Foo'> style (#17889) 2025-05-06 20:11:25 -04:00
type_properties [ty] allow T: Never as subtype of Never (#18687) 2025-06-16 17:46:17 +00:00
type_qualifiers [ty] Pull types on synthesized Python files created by mdtest (#18539) 2025-06-12 10:32:17 +01:00
unary Update class literal display to use <class 'Foo'> style (#17889) 2025-05-06 20:11:25 -04:00
with [ty] Add hint if async context manager is used in non-async with statement (#18299) 2025-05-26 21:34:47 +02:00
.mdformat.toml
attributes.md [ty] basic narrowing on attribute and subscript expressions (#17643) 2025-06-17 11:07:46 +02:00
cycle.md [ty] Add cycle handling for unpacking targets (#18078) 2025-05-13 21:27:48 +00:00
dataclass_transform.md [ty] Detect overloads decorated with @dataclass_transform (#17835) 2025-05-07 15:51:13 +02:00
dataclasses.md [ty] Support dataclasses.KW_ONLY (#18677) 2025-06-16 17:27:55 +00:00
decorators.md ty_python_semantic: add union type context to function call type errors 2025-05-09 13:40:51 -04:00
del.md [ty] support del statement and deletion of except handler names (#18593) 2025-06-12 07:44:42 -07:00
descriptor_protocol.md [ty] type narrowing by attribute/subscript assignments (#18041) 2025-06-04 17:24:27 -07:00
final.md
intersection_types.md [ty] Unify Type::is_subtype_of() and Type::is_assignable_to() (#18430) 2025-06-06 17:28:55 +00:00
invalid_syntax.md
known_constants.md
mdtest_config.md
mdtest_custom_typeshed.md [ty] Fix duplicate diagnostics for unresolved module when an import from statement imports multiple members (#17886) 2025-05-06 12:37:10 +01:00
metaclass.md Update class literal display to use <class 'Foo'> style (#17889) 2025-05-06 20:11:25 -04:00
mro.md [ty] Implement implicit inheritance from Generic[] for PEP-695 generic classes (#18283) 2025-05-26 20:40:16 +01:00
named_tuple.md [ty] Add generic inference for dataclasses (#18443) 2025-06-03 09:59:43 -07:00
overloads.md
pep695_type_aliases.md [ty] Support typing.TypeAliasType (#18156) 2025-05-19 16:36:49 +02:00
properties.md ty_python_semantic: add union type context to function call type errors 2025-05-09 13:40:51 -04:00
protocols.md [ty] Unify Type::is_subtype_of() and Type::is_assignable_to() (#18430) 2025-06-06 17:28:55 +00:00
slots.md
statically_known_branches.md [ty] Reachability constraints (#18621) 2025-06-17 09:24:28 +02:00
sys_platform.md
sys_version_info.md
terminal_statements.md
type_api.md [ty] Fix panics when pulling types for various special forms that have the wrong number of parameters (#18642) 2025-06-17 10:40:50 +01:00
typed_dict.md
union_types.md
unpacking.md [ty] Add tests for empty list/tuple unpacking (#18451) 2025-06-04 02:40:26 +00:00
unreachable.md [ty] Reachability constraints (#18621) 2025-06-17 09:24:28 +02:00