[ty] Understand homogeneous tuple annotations (#17998)

This commit is contained in:
Alex Waygood
2025-05-12 22:02:25 -04:00
committed by GitHub
parent f301931159
commit 55df9271ba
17 changed files with 196 additions and 104 deletions

View File

@@ -70,7 +70,7 @@ def _(m: int, n: int):
tuple_slice = t[m:n]
# TODO: Should be `tuple[Literal[1, 'a', b"b"] | None, ...]`
reveal_type(tuple_slice) # revealed: @Todo(full tuple[...] support)
reveal_type(tuple_slice) # revealed: tuple[Unknown, ...]
```
## Inheritance
@@ -101,7 +101,7 @@ class A: ...
def _(c: Tuple, d: Tuple[int, A], e: Tuple[Any, ...]):
reveal_type(c) # revealed: tuple[Unknown, ...]
reveal_type(d) # revealed: tuple[int, A]
reveal_type(e) # revealed: @Todo(full tuple[...] support)
reveal_type(e) # revealed: tuple[Any, ...]
```
### Inheritance