filter
does not narrow TypeVar
used in TypeGuard
signature
#12996
Labels
bug
mypy got something wrong
topic-type-variables
topic-typeguard-typeis
TypeGuard / TypeIs / PEP 647 / PEP 742
Uh oh!
There was an error while loading. Please reload this page.
Bug Report
Using
filter
with aTypeGuard
, theTypeVar
used in theTypeGuard
signature is not properly narrowed.To Reproduce
Expected Behavior
I wouldn't expect any error. Since the second argument to
filter
is typed aslist[Optional[int]]
, mypy should narrow theTypeVar
T
appropriately.Your Environment
mypy 0.950
mypy.ini
(and other config files): noneThis may be related to #12682. I decided to open a new ticket instead of commenting on that issue because the repro above feels different from the one reported on that issue.
The text was updated successfully, but these errors were encountered: