Skip to content
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

map has a problem with generic types #6703

Closed
sambhav opened this issue Apr 19, 2019 · 1 comment
Closed

map has a problem with generic types #6703

sambhav opened this issue Apr 19, 2019 · 1 comment

Comments

@sambhav
Copy link

sambhav commented Apr 19, 2019

Note: if you are reporting a wrong signature of a function or a class in
the standard library, then the typeshed tracker is better suited
for this report: https://github.com/python/typeshed/issues

Please provide more information to help us understand the issue:

  • Are you reporting a bug, or opening a feature request?
    bug
  • Please insert below the code you are checking with mypy,
    or a mock-up repro if the source is private. We would appreciate
    if you try to simplify your case to a minimal repro.
from typing import TypeVar
T = TypeVar("T")
def foo(bar: T) -> T:
    return bar
map(foo, [1])
  • What is the actual behavior/output?
    error: Argument 1 to "map" has incompatible type "Callable[[T], T]"; expected "Callable[[int], T]"

  • What is the behavior/output you expect?
    For mypy to successfully pass

  • What are the versions of mypy and Python you are using?
    Python 3.7.1 and the mypy-0.710+dev.f0491839adf2db2da74768b1d01f8e244e769f59
    Do you see the same issue after installing mypy from Git master?
    Yes

  • What are the mypy flags you are using? (For example --strict-optional)
    None

  • If mypy crashed with a traceback, please paste
    the full traceback below.

(You can freely edit this text, please remove all the lines
you believe are unnecessary.)

@ilevkivskyi
Copy link
Member

Duplicate of #6697

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