ruff/crates/ty_python_semantic/resources/mdtest/annotations
Douglas Creager f301931159
[ty] Induct into instances and subclasses when finding and applying generics (#18052)
We were not inducting into instance types and subclass-of types when
looking for legacy typevars, nor when apply specializations.

This addresses
https://github.com/astral-sh/ruff/pull/17832#discussion_r2081502056

```py
from __future__ import annotations
from typing import TypeVar, Any, reveal_type

S = TypeVar("S")

class Foo[T]:
    def method(self, other: Foo[S]) -> Foo[T | S]: ...  # type: ignore[invalid-return-type]

def f(x: Foo[Any], y: Foo[Any]):
    reveal_type(x.method(y))  # revealed: `Foo[Any | S]`, but should be `Foo[Any]`
```

We were not detecting that `S` made `method` generic, since we were not
finding it when searching the function signature for legacy typevars.
2025-05-12 21:53:11 -04:00
..
annotated.md Update class literal display to use <class 'Foo'> style (#17889) 2025-05-06 20:11:25 -04:00
any.md Update class literal display to use <class 'Foo'> style (#17889) 2025-05-06 20:11:25 -04:00
callable.md [ty] Silence false positives for PEP-695 ParamSpec annotations (#18001) 2025-05-10 11:59:25 +02:00
deferred.md Rename Red Knot (#17820) 2025-05-03 19:49:15 +02:00
int_float_complex.md Rename Red Knot (#17820) 2025-05-03 19:49:15 +02:00
invalid.md Rename Red Knot (#17820) 2025-05-03 19:49:15 +02:00
literal.md Rename Red Knot (#17820) 2025-05-03 19:49:15 +02:00
literal_string.md Rename Red Knot (#17820) 2025-05-03 19:49:15 +02:00
never.md Rename Red Knot (#17820) 2025-05-03 19:49:15 +02:00
new_types.md ty_python_semantic: add union type context to function call type errors 2025-05-09 13:40:51 -04:00
optional.md Rename Red Knot (#17820) 2025-05-03 19:49:15 +02:00
self.md [ty] Induct into instances and subclasses when finding and applying generics (#18052) 2025-05-12 21:53:11 -04:00
starred.md [ty] Understand classes that inherit from subscripted Protocol[] as generic (#17832) 2025-05-09 17:39:15 +01:00
stdlib_typing_aliases.md [ty] Understand classes that inherit from subscripted Protocol[] as generic (#17832) 2025-05-09 17:39:15 +01:00
string.md Rename Red Knot (#17820) 2025-05-03 19:49:15 +02:00
union.md Rename Red Knot (#17820) 2025-05-03 19:49:15 +02:00
unsupported_special_forms.md [ty] Understand classes that inherit from subscripted Protocol[] as generic (#17832) 2025-05-09 17:39:15 +01:00
unsupported_special_types.md Generalize special-casing for enums constructed with the functional syntax (#17885) 2025-05-06 11:02:55 +01:00
unsupported_type_qualifiers.md Rename Red Knot (#17820) 2025-05-03 19:49:15 +02:00