ruff/crates/ty_python_semantic
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
..
resources [ty] impl VarianceInferable for KnownInstanceType (#20924) 2025-10-17 21:12:19 +02:00
src [ty] impl VarianceInferable for KnownInstanceType (#20924) 2025-10-17 21:12:19 +02:00
tests [ty] Limit shown import paths to at most 5 unless ty runs with -v (#20912) 2025-10-16 13:18:09 +02:00
build.rs
Cargo.toml [ty] Avoid overcounting shared memory usage (#19773) 2025-08-06 15:32:02 -04:00
mdtest.py [ty] Faster iteration on mdtests (#20465) 2025-09-18 10:48:52 +00:00
mdtest.py.lock