Repository navigation
Report error when type alias has multiple TypeVarTuples (PEP 695) - #20554
aviralgarg05 wants to merge 4 commits into
Conversation
When defining a type alias using the PEP 695 syntax with multiple TypeVarTuple-based type parameters (e.g., `type TA[*Ts1, *Ts2] = ...`), mypy now reports an error at definition time rather than only when the alias is used. This is consistent with how mypy handles classes with multiple TypeVarTuples and matches the behavior of other type checkers like pyright and pyrefly. Fixes python#20544.
This comment has been minimized.
This comment has been minimized.
|
Could you support old-style type aliases too? The linked issue has that too, simply uncomment it. |
This comment has been minimized.
This comment has been minimized.
|
CI failures look like it's because |
|
According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅ |
|
Closing this because current master now includes #22216, which centralizes multiple-TypeVarTuple validation and covers both old and PEP 695 alias syntax. That supersedes this implementation, so rebasing it would duplicate the newer fix. Thanks again for the earlier review. |
Report error when type alias has multiple TypeVarTuples (PEP 695)
When defining a type alias using the PEP 695 syntax with multiple TypeVarTuple-based type parameters (e.g.,
type TA[*Ts1, *Ts2] = ...), mypy now reports an error at definition time rather than only when the alias is used.This is consistent with how mypy handles classes with multiple TypeVarTuples and matches the behavior of other type checkers like pyright and pyrefly.
Fixes #20544.