You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This example started generating errors after #8077:
fromtypingimportOptional, TypeVar, Iterable, Iterator, List_T=TypeVar('_T')
deffilter(__function: None, __iterable: Iterable[Optional[_T]]) ->List[_T]: ...
x: Optional[str]
# Need type annotation for 'pagelets'# List item 0 has incompatible type "Optional[str]"; expected "None"pagelets=filter(None, [x])
The issue also happens with Python 2 filter(), at least.
Fixes#8093
The fix is kind of simple, we really need to keep all `ErasedType`s intact to preserve the existing type inference logic, but it is also long because I need to thread the flag down like dozen function calls.
The issue itself btw highlight how fragile is current type inference logic (note that `expand_type()` implicitly calls `make_simplified_union()` too, but I think that one doesn't need to be updated because it shouldn't be called with any erased components).
This example started generating errors after #8077:
The issue also happens with Python 2
filter()
, at least.cc @ilevkivskyi
The text was updated successfully, but these errors were encountered: