ruff/crates/ty_python_semantic/resources/mdtest
Douglas Creager fe653de3dd
[ty] Infer parameter specializations of explicitly implemented generic protocols (#18054)
Follows on from (and depends on)
https://github.com/astral-sh/ruff/pull/18021.

This updates our function specialization inference to infer type
mappings from parameters that are generic protocols.

For now, this only works when the argument _explicitly_ implements the
protocol by listing it as a base class. (We end up using exactly the
same logic as for generic classes in #18021.) For this to work with
classes that _implicitly_ implement the protocol, we will have to check
the types of the protocol members (which we are not currently doing), so
that we can infer the specialization of the protocol that the class
implements.

---------

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2025-05-13 13:13:00 -04:00
..
annotations [ty] Understand homogeneous tuple annotations (#17998) 2025-05-12 22:02:25 -04:00
assignment [ty] Understand homogeneous tuple annotations (#17998) 2025-05-12 22:02:25 -04:00
binary [ty] Infer parameter specializations of generic aliases (#18021) 2025-05-12 22:12:44 -04:00
boolean Rename Red Knot (#17820) 2025-05-03 19:49:15 +02:00
boundness_declaredness Update class literal display to use <class 'Foo'> style (#17889) 2025-05-06 20:11:25 -04:00
call [ty] Understand homogeneous tuple annotations (#17998) 2025-05-12 22:02:25 -04:00
class Update class literal display to use <class 'Foo'> style (#17889) 2025-05-06 20:11:25 -04:00
comparison Rename Red Knot (#17820) 2025-05-03 19:49:15 +02:00
comprehensions Rename Red Knot (#17820) 2025-05-03 19:49:15 +02:00
conditional Rename Red Knot (#17820) 2025-05-03 19:49:15 +02:00
declaration Rename Red Knot (#17820) 2025-05-03 19:49:15 +02:00
diagnostics [ty] Add a note to the diagnostic if a new builtin is used on an old Python version (#18068) 2025-05-13 10:08:04 -04:00
directives [ty] Improve diagnostics for assert_type and assert_never (#18050) 2025-05-13 13:00:20 +00:00
doc ty_python_semantic: add union type context to function call type errors 2025-05-09 13:40:51 -04:00
exception [ty] Understand homogeneous tuple annotations (#17998) 2025-05-12 22:02:25 -04:00
expression [ty] Understand classes that inherit from subscripted Protocol[] as generic (#17832) 2025-05-09 17:39:15 +01:00
function [ty] Understand homogeneous tuple annotations (#17998) 2025-05-12 22:02:25 -04:00
generics [ty] Infer parameter specializations of explicitly implemented generic protocols (#18054) 2025-05-13 13:13:00 -04:00
import [ty] Recognize submodules in self-referential imports (#18005) 2025-05-13 16:59:11 +02:00
literal [ty] Understand classes that inherit from subscripted Protocol[] as generic (#17832) 2025-05-09 17:39:15 +01:00
loops Rename Red Knot (#17820) 2025-05-03 19:49:15 +02:00
narrow [ty] Add tests for else branches of hasattr() narrowing (#18067) 2025-05-13 09:57:53 -04:00
regression Rename Red Knot (#17820) 2025-05-03 19:49:15 +02:00
scopes [ty] __file__ is always a string inside a Python module (#18071) 2025-05-13 08:20:43 -07:00
shadowing Rename Red Knot (#17820) 2025-05-03 19:49:15 +02:00
snapshots [ty] Shorten snapshot names (#18039) 2025-05-13 18:43:19 +02:00
stubs Update class literal display to use <class 'Foo'> style (#17889) 2025-05-06 20:11:25 -04:00
subscript [ty] Understand homogeneous tuple annotations (#17998) 2025-05-12 22:02:25 -04:00
suppressions Rename Red Knot (#17820) 2025-05-03 19:49:15 +02:00
type_of Update class literal display to use <class 'Foo'> style (#17889) 2025-05-06 20:11:25 -04:00
type_properties [ty] Understand homogeneous tuple annotations (#17998) 2025-05-12 22:02:25 -04:00
type_qualifiers Rename Red Knot (#17820) 2025-05-03 19:49:15 +02:00
unary Update class literal display to use <class 'Foo'> style (#17889) 2025-05-06 20:11:25 -04:00
with Rename Red Knot (#17820) 2025-05-03 19:49:15 +02:00
.mdformat.toml Rename Red Knot (#17820) 2025-05-03 19:49:15 +02:00
attributes.md [ty] Understand homogeneous tuple annotations (#17998) 2025-05-12 22:02:25 -04:00
cycle.md [ty] add cycle handling for FunctionType::signature query (#17833) 2025-05-05 12:12:38 -07:00
dataclass_transform.md [ty] Detect overloads decorated with @dataclass_transform (#17835) 2025-05-07 15:51:13 +02:00
dataclasses.md [ty] Implement DataClassInstance protocol for dataclasses. (#18018) 2025-05-13 10:31:26 +02:00
decorators.md ty_python_semantic: add union type context to function call type errors 2025-05-09 13:40:51 -04:00
descriptor_protocol.md Update class literal display to use <class 'Foo'> style (#17889) 2025-05-06 20:11:25 -04:00
final.md Rename Red Knot (#17820) 2025-05-03 19:49:15 +02:00
intersection_types.md Rename Red Knot (#17820) 2025-05-03 19:49:15 +02:00
invalid_syntax.md Rename Red Knot (#17820) 2025-05-03 19:49:15 +02:00
known_constants.md Rename Red Knot (#17820) 2025-05-03 19:49:15 +02:00
mdtest_config.md Rename Red Knot (#17820) 2025-05-03 19:49:15 +02:00
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] Allow classes to inherit from type[Any] or type[Unknown] (#18060) 2025-05-12 20:30:21 -04:00
named_tuple.md [ty] Add more tests for NamedTuples (#17975) 2025-05-10 10:46:08 +02:00
overloads.md Rename Red Knot (#17820) 2025-05-03 19:49:15 +02:00
pep695_type_aliases.md [ty] Understand homogeneous tuple annotations (#17998) 2025-05-12 22:02:25 -04: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] Understand classes that inherit from subscripted Protocol[] as generic (#17832) 2025-05-09 17:39:15 +01:00
slots.md Rename Red Knot (#17820) 2025-05-03 19:49:15 +02:00
statically_known_branches.md Fix typos (#17988) 2025-05-09 14:57:14 -04:00
sys_platform.md Rename Red Knot (#17820) 2025-05-03 19:49:15 +02:00
sys_version_info.md Rename Red Knot (#17820) 2025-05-03 19:49:15 +02:00
terminal_statements.md Rename Red Knot (#17820) 2025-05-03 19:49:15 +02:00
type_api.md Update class literal display to use <class 'Foo'> style (#17889) 2025-05-06 20:11:25 -04:00
typed_dict.md Rename Red Knot (#17820) 2025-05-03 19:49:15 +02:00
union_types.md Rename Red Knot (#17820) 2025-05-03 19:49:15 +02:00
unpacking.md Rename Red Knot (#17820) 2025-05-03 19:49:15 +02:00
unreachable.md Rename Red Knot (#17820) 2025-05-03 19:49:15 +02:00