[ty] Infer slightly more precise types for comprehensions (#20111)

This commit is contained in:
Alex Waygood
2025-08-27 13:21:47 +01:00
committed by GitHub
parent d71518b369
commit 7d0c8e045c
16 changed files with 111 additions and 95 deletions

View File

@@ -75,7 +75,7 @@ a: tuple[()] = (1, 2)
# error: [invalid-assignment] "Object of type `tuple[Literal["foo"]]` is not assignable to `tuple[int]`"
b: tuple[int] = ("foo",)
# error: [invalid-assignment] "Object of type `tuple[list[Unknown], Literal["foo"]]` is not assignable to `tuple[str | int, str]`"
# error: [invalid-assignment]
c: tuple[str | int, str] = ([], "foo")
```