-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Open
Labels
bugmypy got something wrongmypy got something wrongtopic-pep-646PEP 646 (TypeVarTuple, Unpack)PEP 646 (TypeVarTuple, Unpack)
Description
class Shape[*Ts](tuple[*Ts]): ...
class Shape0(Shape[()]): ...
class Shape1(Shape[int]): ...
def rank(shape: tuple[int, ...]) -> int:
return len(shape)
_ = rank(Shape()) # ✅
_ = rank(()) # ✅
_ = rank(Shape0()) # ❌ Argument 1 to "rank" has incompatible type "Shape0"; expected "tuple[int, ...]"
_ = rank(Shape1([1])) # ✅
Perhaps this is related to #19105, which also involves empty tuple subtypes.
Metadata
Metadata
Assignees
Labels
bugmypy got something wrongmypy got something wrongtopic-pep-646PEP 646 (TypeVarTuple, Unpack)PEP 646 (TypeVarTuple, Unpack)