Skip to content

Commit 41af679

Browse files
committed
more tests
1 parent 3260b03 commit 41af679

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

crates/ty_python_semantic/resources/mdtest/assignment/annotations.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,13 @@ reveal_type(o) # revealed: list[tuple[Literal[1], ...]]
222222

223223
p: list[tuple[int, ...]] = [(1, 1, 1)]
224224
reveal_type(p) # revealed: list[tuple[int, ...]]
225+
226+
# literal promotion occurs based on assignability, an exact match is not required
227+
q: list[int | Literal[1]] = [1]
228+
reveal_type(q) # revealed: list[int]
229+
230+
r: list[Literal[1, 2, 3, 4]] = [1, 2]
231+
reveal_type(r) # revealed: list[Literal[1, 2, 3, 4]]
225232
```
226233

227234
## PEP-604 annotations are supported

0 commit comments

Comments
 (0)