You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ParamSpecs are allowed to be defined in class generics like this: Foo[[int, str]]. This is allowed to be simplified for readability reasons like this: Foo[int, str]. It should however only work if a ParamSpec is the only generic type variable. In the example below however we get a weird case where this simplification is applied even though it shouldn't.
In case multiple type variables or param specs are defining a class, the param spec should not be simplified and the type application above D[int, bytes] should not be allowed.
The text was updated successfully, but these errors were encountered:
This adds some missing pieces to runtime type application handling for
both `TypeVarTuple` and `ParamSpec`. Everything is straightforward
(maybe a bit hacky, but we already import `typeanal` in `checkexpr` for
similar purposes, e.g. type aliases in runtime context).
Fixes#14799
Bug Report
ParamSpecs are allowed to be defined in class generics like this:
Foo[[int, str]]
. This is allowed to be simplified for readability reasons like this:Foo[int, str]
. It should however only work if aParamSpec
is the only generic type variable. In the example below however we get a weird case where this simplification is applied even though it shouldn't.To Reproduce
See also: https://mypy-play.net/?mypy=latest&python=3.12&gist=1c1e42d6e323cb2dcc54a7c06b440cac
Expected Behavior
In case multiple type variables or param specs are defining a class, the param spec should not be simplified and the type application above
D[int, bytes]
should not be allowed.The text was updated successfully, but these errors were encountered: