Either both of these should error, or neither of them.
deftest1(items: tuple[int, ...]) ->None:
reveal_type(items[1]) # ✅️reveal_type(items[2]) # ✅️reveal_type(items[3]) # ✅️deftest2(items: tuple[int, *tuple[int, ...]]) ->None:
reveal_type(items[1]) # ❌️ tuple index out of rangereveal_type(items[2]) # ❌️ tuple index out of rangereveal_type(items[3]) # ❌️ tuple index out of range
https://mypy-play.net/?mypy=master&python=3.12&gist=dc9de67cb18ae540cdbb6bc32632eae7
FWIW, only mypy errors here. pyright (strict): no errors, pyrefly no errors, ty: no errors.
Such tuple types can occur naturally, which makes this check prone to false positives, for instance tup=(id, *values), when values is list-like.
Either both of these should error, or neither of them.
https://mypy-play.net/?mypy=master&python=3.12&gist=dc9de67cb18ae540cdbb6bc32632eae7
FWIW, only mypy errors here.
pyright (strict): no errors,pyreflyno errors,ty: no errors.Such tuple types can occur naturally, which makes this check prone to false positives, for instance
tup=(id, *values), whenvaluesis list-like.