False positive following case None
in match
statement (missed narrowing?)
#13046
Labels
bug
mypy got something wrong
topic-match-statement
Python 3.10's match statement
topic-type-narrowing
Conditional type narrowing / binder
Bug Report
In
match
block with acase None:
, mypy considers values captured by subsequent cases to still haveNone
as a possible type.To Reproduce
Check the following code using mypy:
Expected Behavior
No errors would be reported: a case that matches the literal
None
can be treated as matchingNoneType
.Actual Behavior
Your Environment
mypy.ini
(and other config files):The text was updated successfully, but these errors were encountered: