Unable to narrow the type of a tagged union when using a match statement #15190
Labels
bug
mypy got something wrong
topic-literal-types
topic-match-statement
Python 3.10's match statement
topic-type-narrowing
Conditional type narrowing / binder
Bug Report
Mypy is unable to narrow the type of a tagged union when deconstructing it using a
match
statement.To Reproduce
Expected Behavior
Both
eval
andeval2
should typecheck.Actual Behavior
Function
eval
typechecks buteval2
does not.Mypy playground link
Your Environment
mypy.ini
(and other config files): noneThe text was updated successfully, but these errors were encountered: