Bug Report
What this #13400 looks like it's supposed to fix is not working here.
To Reproduce
fromtypingimportCallableclassC:
f: Callable[[int], bool] =staticmethod(lambdax: print(type(x)) orTrue)
c=C()
c.f(3)
classD:
f: Callable[[int], bool] =lambdax: print(type(x)) orTrued=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:
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:
Traceback (most recent call last):
File ...
d.f(3)
TypeError: <lambda>() takes 1 positional argument but 2 were given
Your Environment
- Mypy version used: 0.990+dev
- Python version used: 3.8
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