We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The first filter call below generates an error when using --py2, but the same call without reveal_type(...) is fine:
filter
--py2
reveal_type(...)
from typing import Any, List a = 0 # type: Any x = filter(None, reveal_type(a)) # type: List[str] # Error x2 = filter(None, a) # type: List[str] # No error
The error message is Incompatible types in assignment (expression has type "Tuple[<nothing>, ...]", variable has type "List[str]").
Incompatible types in assignment (expression has type "Tuple[<nothing>, ...]", variable has type "List[str]")
reveal_type should have no effect on inferred types, since it's often used to diagnose issues with type inference.
reveal_type
The text was updated successfully, but these errors were encountered:
This error is still reproduceable if you run mypy with --python-version 2.7. It's also reproduceable with Python 3 set as the Python version, if you copy-paste typeshed's Python-2 stub for filter into a file:
--python-version 2.7
from typing import * _T = TypeVar("_T") a = 0 # type: Any @overload # type: ignore[no-overload-impl] def py2_filter(__function: Callable[[AnyStr], Any], __iterable: AnyStr) -> AnyStr: ... # type: ignore @overload def py2_filter(__function: None, __iterable: tuple[_T | None, ...]) -> tuple[_T, ...]: ... # type: ignore @overload def py2_filter(__function: Callable[[_T], Any], __iterable: tuple[_T, ...]) -> tuple[_T, ...]: ... # type: ignore @overload def py2_filter(__function: None, __iterable: Iterable[_T | None]) -> list[_T]: ... @overload def py2_filter(__function: Callable[[_T], Any], __iterable: Iterable[_T]) -> list[_T]: ... y = py2_filter(None, reveal_type(a)) # type: List[str] # Error y2 = py2_filter(None, a) # type: List[str] # No error
Sorry, something went wrong.
No branches or pull requests
The first
filter
call below generates an error when using--py2
, but the same call withoutreveal_type(...)
is fine:The error message is
Incompatible types in assignment (expression has type "Tuple[<nothing>, ...]", variable has type "List[str]")
.reveal_type
should have no effect on inferred types, since it's often used to diagnose issues with type inference.The text was updated successfully, but these errors were encountered: