mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-28 12:55:05 +00:00
![]() 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. |
||
---|---|---|
.. | ||
module_resolver | ||
semantic_index | ||
types | ||
util | ||
ast_node_ref.rs | ||
db.rs | ||
dunder_all.rs | ||
lib.rs | ||
lint.rs | ||
list.rs | ||
module_name.rs | ||
node_key.rs | ||
program.rs | ||
python_platform.rs | ||
semantic_index.rs | ||
semantic_model.rs | ||
site_packages.rs | ||
suppression.rs | ||
symbol.rs | ||
types.rs | ||
unpack.rs |