ruff
dfb5e926 - [ty] Add help message to invalid-generic-class variance diagnostic (#25385)

Commit
87 days ago
[ty] Add help message to invalid-generic-class variance diagnostic (#25385) ## Summary When a generic subclass uses an explicitly-declared TypeVar in a base class position where the variance is incompatible, the existing diagnostic only reported which type variable and base class were involved: Variance of type variable `T_co` is incompatible with base class `Invariant` This adds a `.help()` sub-diagnostic that explains *why* it is incompatible and what the base class actually requires: Type variable `T_co` is declared as covariant, but base class `Invariant` requires it to be invariant ## Test Plan Added a new mdtest section in `crates/ty_python_semantic/resources/mdtest/generics/legacy/variance.md` covering all four incompatible variance combinations, verifying the exact diagnostic message text. --------- Co-authored-by: David Peter <mail@david-peter.de>
Author
Parents
Loading