ruff/crates/ty_python_semantic/resources/mdtest/generics/pep695
Douglas Creager 2ac4147435
[ty] Add mdtests that exercise constraint sets (#20319)
This PR adds a new `ty_extensions.ConstraintSet` class, which is used to
expose constraint sets to our mdtest framework. This lets us write a
large collection of unit tests that exercise the invariants and rewrite
rules of our constraint set implementation.

As part of this, `is_assignable_to` and friends are updated to return a
`ConstraintSet` instead of a `bool`, and we implement
`ConstraintSet.__bool__` to return when a constraint set is always
satisfied. That lets us still use
`static_assert(is_assignable_to(...))`, since the assertion will coerce
the constraint set to a bool, and also lets us
`reveal_type(is_assignable_to(...))` to see more detail about
whether/when the two types are assignable. That lets us get rid of
`reveal_when_assignable_to` and friends, since they are now redundant
with the expanded capabilities of `is_assignable_to`.
2025-09-10 13:22:19 -04:00
..
aliases.md [ty] Add support for generic PEP695 type aliases (#20219) 2025-09-08 13:26:21 -07:00
classes.md [ty] Add support for generic PEP695 type aliases (#20219) 2025-09-08 13:26:21 -07:00
functions.md [ty] Support "legacy" typing.Self in combination with PEP 695 generic contexts (#20304) 2025-09-08 16:57:09 +02:00
variables.md [ty] Add mdtests that exercise constraint sets (#20319) 2025-09-10 13:22:19 -04:00
variance.md [ty] linear variance inference for PEP-695 type parameters (#18713) 2025-08-19 17:54:09 -07:00