From a080a080f61d945712f17f68882b3b3b5781e1c8 Mon Sep 17 00:00:00 2001 From: Martin Fischer Date: Mon, 28 Feb 2022 16:12:22 +0100 Subject: add puzzles/infer_literal_narrowing.py --- puzzles/infer_literal_narrowing.py | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 puzzles/infer_literal_narrowing.py (limited to 'puzzles/infer_literal_narrowing.py') 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 -- cgit v1.2.3