summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Fischer <martin@push-f.com>2022-02-28 16:12:22 +0100
committerMartin Fischer <martin@push-f.com>2022-02-28 16:12:22 +0100
commita080a080f61d945712f17f68882b3b3b5781e1c8 (patch)
tree5f2337db8e6d9cc0ccc89f096e888ceb0414b8c5
parentf752a8559959733f2224e92c8a86b512278371f9 (diff)
add puzzles/infer_literal_narrowing.py
-rw-r--r--puzzles/infer_literal_narrowing.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/puzzles/infer_literal_narrowing.py b/puzzles/infer_literal_narrowing.py
new file mode 100644
index 0000000..953405a
--- /dev/null
+++ b/puzzles/infer_literal_narrowing.py
@@ -0,0 +1,5 @@
+from typing import Literal
+
+def f(x: int) -> None:
+ if x == 1 or x == 2:
+ _: Literal[1, 2] = x