Skip to content

Inferring lambda doesn't seem to work on mypy 0.4.2 #1710

New issue

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

Closed
cpdean opened this issue Jun 15, 2016 · 2 comments
Closed

Inferring lambda doesn't seem to work on mypy 0.4.2 #1710

cpdean opened this issue Jun 15, 2016 · 2 comments

Comments

@cpdean
Copy link

cpdean commented Jun 15, 2016

Running mypy on the following file, lambdas.py:

from typing import Any, Callable
def apply(d, f):
    # type: (int, Callable[[Any], None]) -> None
    f(d)

apply(1, lambda x: None)

I get the error

lambdas.py:6: error: Argument 2 to "apply" has incompatible type Callable[[Any], None]; expected Callable[[Any], None]

It seems like mypy is having trouble inferring the right thing about the given inline lambda function with python 2 style annotations.

Also, the error message seems misleading because it's claiming the incompatible type is not the expected, but the error message says they're both the same thing.

mypy 0.4.2
python 3.5.0

Thanks!

@rwbarton
Copy link
Contributor

Thanks for the report. This is a duplicate of #1425.

@cpdean
Copy link
Author

cpdean commented Jun 16, 2016

woops, sorry about that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants