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
What this #13400 looks like it's supposed to fix is not working here.
To Reproduce
from typing import Callable class C: f: Callable[[int], bool] = staticmethod(lambda x: print(type(x)) or True) c = C() c.f(3) class D: f: Callable[[int], bool] = lambda x: print(type(x)) or True d = D() d.f(3)
Expected Behavior
The one that works correctly should not have a mypy error. The one that doesn't work correctly should be found by mypy.
Actual Behavior
The first one, class C, works correctly, but mypy says it's wrong. output:
<class 'int'>
mypy: Incompatible types in assignment (expression has type "staticmethod[bool]", variable has type "Callable[[int], bool]") [assignment]
Incompatible types in assignment (expression has type "staticmethod[bool]", variable has type "Callable[[int], bool]") [assignment]
The second one, class D, fails, but mypy doesn't see any problem with it. output:
Traceback (most recent call last): File ... d.f(3) TypeError: <lambda>() takes 1 positional argument but 2 were given
Your Environment
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Bug Report
What this #13400 looks like it's supposed to fix is not working here.
To Reproduce
Expected Behavior
The one that works correctly should not have a mypy error.
The one that doesn't work correctly should be found by mypy.
Actual Behavior
The first one, class C, works correctly, but mypy says it's wrong.
output:
mypy:
Incompatible types in assignment (expression has type "staticmethod[bool]", variable has type "Callable[[int], bool]") [assignment]
The second one, class D, fails, but mypy doesn't see any problem with it.
output:
Your Environment
The text was updated successfully, but these errors were encountered: