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

(🐞) Narrower overload impl return included in union creates false error #12672

Open
KotlinIsland opened this issue Apr 26, 2022 · 0 comments
Labels
bug mypy got something wrong topic-overloads

Comments

@KotlinIsland
Copy link
Contributor

related to: #12434

from typing import overload

@overload
def f(a: int) -> int: ...
@overload
def f(a: str) -> str: ...

def f(a: int | str) -> bool | str: ...  # E: Overloaded function implementation cannot produce return type of signature 1

This impl can definitely produce the return type of signature 1.

@KotlinIsland KotlinIsland added the bug mypy got something wrong label Apr 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug mypy got something wrong topic-overloads
Projects
None yet
Development

No branches or pull requests

2 participants