ruff/crates/ty_python_semantic/resources/mdtest/generics/pep695
Shunsuke Shibayama e4384fc212
[ty] impl VarianceInferable for KnownInstanceType (#20924)
## Summary

Derived from #20900

Implement `VarianceInferable` for `KnownInstanceType` (especially for
`KnownInstanceType::TypeAliasType`).

The variance of a type alias matches its value type. In normal usage,
type aliases are expanded to value types, so the variance of a type
alias can be obtained without implementing this. However, for example,
if we want to display the variance when hovering over a type alias, we
need to be able to obtain the variance of the type alias itself (cf.
#20900).

## Test Plan

I couldn't come up with a way to test this in mdtest, so I'm testing it
in a test submodule at the end of `types.rs`.
I also added a test to `mdtest/generics/pep695/variance.md`, but it
passes without the changes in this PR.
2025-10-17 21:12:19 +02:00
..
aliases.md [ty] Add support for generic PEP695 type aliases (#20219) 2025-09-08 13:26:21 -07:00
classes.md [ty] Improve diagnostics for bad @overload definitions (#20745) 2025-10-07 21:52:57 +00:00
functions.md [ty] bidirectional type inference using function return type annotations (#20528) 2025-10-11 00:38:35 +00:00
variables.md [ty] Add mdtests that exercise constraint sets (#20319) 2025-09-10 13:22:19 -04:00
variance.md [ty] impl VarianceInferable for KnownInstanceType (#20924) 2025-10-17 21:12:19 +02:00