ruff/crates/ty_python_semantic/resources/mdtest/generics
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
..
legacy [ty] Diagnostic for generic classes that reference typevars in enclosing scope (#20822) 2025-10-13 19:30:49 -04:00
pep695 [ty] impl VarianceInferable for KnownInstanceType (#20924) 2025-10-17 21:12:19 +02: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] Diagnostic for generic classes that reference typevars in enclosing scope (#20822) 2025-10-13 19:30:49 -04:00