ruff/crates/ty_python_semantic/resources/mdtest/generics
Douglas Creager c02bd11b93
[ty] Infer typevar specializations for `Callable` types (#21551)
This is a first stab at solving
https://github.com/astral-sh/ty/issues/500, at least in part, with the
old solver. We add a new `TypeRelation` that lets us opt into using
constraint sets to describe when a typevar is assignability to some
type, and then use that to calculate a constraint set that describes
when two callable types are assignable. If the callable types contain
typevars, that constraint set will describe their valid specializations.
We can then walk through all of the ways the constraint set can be
satisfied, and record a type mapping in the old solver for each one.

---------

Co-authored-by: Carl Meyer <carl@astral.sh>
Co-authored-by: Alex Waygood <alex.waygood@gmail.com>
2025-12-16 09:16:49 -08:00
..
legacy [ty] Infer typevar specializations for `Callable` types (#21551) 2025-12-16 09:16:49 -08:00
pep695 [ty] Infer typevar specializations for `Callable` types (#21551) 2025-12-16 09:16:49 -08:00
builtins.md [ty] Support using legacy typing aliases for generic classes in type annotations (#18404) 2025-06-03 12:09:51 +01:00
scoping.md [ty] Enable even more goto-definition on inlay hints (#21950) 2025-12-12 12:57:38 -05:00
specialize_constrained.md [ty] Infer typevar specializations for `Callable` types (#21551) 2025-12-16 09:16:49 -08:00