Skip to content

Commit

Permalink
clarify we don't narrow the left operand
Browse files Browse the repository at this point in the history
  • Loading branch information
ikonst committed Nov 4, 2022
1 parent 620da98 commit fb564eb
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions test-data/unit/check-typeddict.test
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit fb564eb

Please sign in to comment.