match
doesn't deduce type of tuple member from guard clause
#12532
Labels
match
doesn't deduce type of tuple member from guard clause
#12532
Uh oh!
There was an error while loading. Please reload this page.
Bug Report
match
can't determine type of an element of a tuple guarded withisinstance
, if the variable holding the tuple has typeAny
.To Reproduce
Expected Behavior
This code should pass type-check.
mypy
should be able to determine the type of "a" because theisinstance
guard implies that "a" must be astr
.Actual Behavior
Variations
If
e
is given no declared type, like this:then mypy reports no errors.
If
e
is declared to be a tuple whose members are unspecified, like this:then mypy reports no errors.
Environment
--python-version 3.10 x.py
mypy.ini
(and other config files): (none)The text was updated successfully, but these errors were encountered: