ruff/crates/red_knot_python_semantic/resources/mdtest/function
Douglas Creager ca4fdf452d
Create `TypeVarInstance` type for legacy typevars (#16538)
We are currently representing type variables using a `KnownInstance`
variant, which wraps a `TypeVarInstance` that contains the information
about the typevar (name, bounds, constraints, default type). We were
previously only constructing that type for PEP 695 typevars. This PR
constructs that type for legacy typevars as well.

It also detects functions that are generic because they use legacy
typevars in their parameter list. With the existing logic for inferring
specializations of function calls (#17301), that means that we are
correctly detecting that the definition of `reveal_type` in the typeshed
is generic, and inferring the correct specialization of `_T` for each
call site.

This does not yet handle legacy generic classes; that will come in a
follow-on PR.
2025-04-29 09:03:06 -04:00
..
parameters.md [red-knot] Detect version-related syntax errors (#16379) 2025-04-17 14:00:30 -04:00
return_type.md Create `TypeVarInstance` type for legacy typevars (#16538) 2025-04-29 09:03:06 -04:00