Open
Description
In the following, very reduced code line d
does not typecheck.
from itertools import chain
from typing import List
ints_of_ints: List[List[int]]
c = filter(lambda ints: len(ints), ints_of_ints) # ok
reveal_type(c) # typing.Iterator[builtins.list[builtins.int]]
d = chain.from_iterable(filter(lambda ints: len(ints), ints_of_ints)) # mypy: error arg-type - Argument 1 to "len" has incompatible type
# "Iterable[int]"; expected "Sized"
reveal_type(d) # typing.Iterator[builtins.int*]
The interesting or surprising part is that inside the d
line mypy thinks that ints
is Iterable[int]
.
Tried mypy 0.782 and mypy-0.790+dev.4cf246f3bb2589d343fe1fdb67a42a23a23c041b.dirty