10000
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
Bug Report
In this code, mypy --strict is unhappy both with and without a cast (playground):
from typing import cast def foo(name: str) -> None: pass def bar( name: str | None = None, ) -> None: if name is None: name = "foo" a = [lambda: foo(name)] # incompatible type "str | None"; expected "str" b = [lambda: foo(cast(str, name))] # Redundant cast to "str" del a, b
Expected Behavior
One of the lines should be ok for mypy.
Actual Behavior
main.py:14: error: Argument 1 to "foo" has incompatible type "str | None"; expected "str" [arg-type] main.py:15: error: Redundant cast to "str" [redundant-cast] Found 2 errors in 1 file (checked 1 source file)
Your Environment
The text was updated successfully, but these errors were encountered:
This is essentially a duplicate of #4297
Sorry, something went wrong.
No branches or pull requests
Bug Report
In this code, mypy --strict is unhappy both with and without a cast (playground):
Expected Behavior
One of the lines should be ok for mypy.
Actual Behavior
Your Environment
The text was updated successfully, but these errors were encountered: