From fb564eb75bbb4a76be08c6763a5b8da69bc724ee Mon Sep 17 00:00:00 2001 From: Ilya Konstantinov Date: Thu, 3 Nov 2022 21:57:16 -0400 Subject: [PATCH] clarify we don't narrow the left operand --- test-data/unit/check-typeddict.test | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test-data/unit/check-typeddict.test b/test-data/unit/check-typeddict.test index b90b87119ccd..1a0b478db0f2 100644 --- a/test-data/unit/check-typeddict.test +++ b/test-data/unit/check-typeddict.test @@ -2078,8 +2078,12 @@ else: foo_or_invalid: Literal['foo', 'invalid'] if foo_or_invalid in d: assert_type(d, D1) + # won't narrow 'foo_or_invalid' + assert_type(foo_or_invalid, Literal['foo', 'invalid']) else: assert_type(d, Union[D1, D2]) + # won't narrow 'foo_or_invalid' + assert_type(foo_or_invalid, Literal['foo', 'invalid']) TD = TypeVar('TD', D1, D2)