filter
does not narrow TypeVar
used in TypeGuard
signature
#12996
Labels
filter
does not narrow TypeVar
used in TypeGuard
signature
#12996
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: