Skip to content

More specific overlapping overload errors #3819

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

Open
OddBloke opened this issue Aug 9, 2017 · 1 comment
Open

More specific overlapping overload errors #3819

OddBloke opened this issue Aug 9, 2017 · 1 comment

Comments

@OddBloke
Copy link
Contributor

OddBloke commented Aug 9, 2017

Again when wrapping my head around #3805, I was thrown off by the output of mypy against:

from typing import *

@overload
def f(arg: str = "foo") -> AbstractSet[Tuple[str, str]]: ...

@overload
def f(arg: int = 0) -> AbstractSet[Tuple[str, Tuple[str, int]]]: ...

which gives

test.pyi:4: error: Overloaded function signatures 1 and 2 overlap with incompatible return types

The problem here is that each overload can be called without arguments (but I didn't see this until an eagle-eyed BDFL pointed it out 😁).

It would be good if the error message could include a little more information about the ways in which the signatures overlap, to make fixing the error an easier experience.

@JukkaL
Copy link
Collaborator

JukkaL commented Aug 9, 2017

It would be nice if would generate a bit more useful error message for at least the most common cases of incompatible overload items.

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

No branches or pull requests

3 participants