summaryrefslogtreecommitdiff
path: root/puzzles/infer_literal_narrowing.py
diff options
context:
space:
mode:
Diffstat (limited to '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