[ty] Understand homogeneous tuple annotations (#17998)
This commit is contained in:
@@ -317,8 +317,7 @@ reveal_type(A() + b"foo") # revealed: A
|
||||
reveal_type(b"foo" + A()) # revealed: bytes
|
||||
|
||||
reveal_type(A() + ()) # revealed: A
|
||||
# TODO this should be `A`, since `tuple.__add__` doesn't support `A` instances
|
||||
reveal_type(() + A()) # revealed: @Todo(full tuple[...] support)
|
||||
reveal_type(() + A()) # revealed: A
|
||||
|
||||
literal_string_instance = "foo" * 1_000_000_000
|
||||
# the test is not testing what it's meant to be testing if this isn't a `LiteralString`:
|
||||
|
||||
@@ -17,6 +17,7 @@ def _(x: tuple[int, str], y: tuple[None, tuple[int]]):
|
||||
|
||||
```py
|
||||
def _(x: tuple[int, ...], y: tuple[str, ...]):
|
||||
reveal_type(x + y) # revealed: @Todo(full tuple[...] support)
|
||||
reveal_type(x + (1, 2)) # revealed: @Todo(full tuple[...] support)
|
||||
# TODO: should be `tuple[int | str, ...]`
|
||||
reveal_type(x + y) # revealed: tuple[int | Unknown, ...]
|
||||
reveal_type(x + (1, 2)) # revealed: tuple[int, ...]
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user