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

Singledispatch return type only tracks base function #8415

Closed
maxrothman opened this issue Feb 17, 2020 · 2 comments
Closed

Singledispatch return type only tracks base function #8415

maxrothman opened this issue Feb 17, 2020 · 2 comments

Comments

@maxrothman
Copy link

Python 3.8
Mypy: 7.6.0
issue type: bug

ffrom functools import singledispatch

@singledispatch
def f(arg) -> str:
    pass

@f.register
def _1(arg: int) -> int:
    return arg

@f.register
def _2(arg: list) -> list:
    return list(map(f, arg))

reveal_type(f(1))

Here's the code in the mypy playground

What is the actual behavior/output?

main.py:15: note: Revealed type is 'builtins.str*'

What is the behavior/output you expect?

main.py:15: note: Revealed type is 'builtins.int*'
@ilevkivskyi
Copy link
Member

Duplicate of #2904

@ilevkivskyi ilevkivskyi marked this as a duplicate of #2904 Feb 17, 2020
@LeuschkeTressa
Copy link

Note: this is now tracked in #11727.

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

3 participants