More specific overlapping overload errors
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
Research direction
Start by reproducing the supplied overload example with mypy and trace the existing diagnostic for incompatible overlapping overloads. Identify the overload-checking and error-reporting entry points; done means the diagnostic explains the overlapping call shapes, including the no-argument call, while preserving the existing incompatibility information.
Written by the indexing model from the issue text.
Description
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.
- Dominant language
- Python
- Stars
- 20.6k
- Forks
- 3.3k
- Avg merge
- 1d 18h
- Merged PRs (30d)
- 54
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from python/mypy
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
documentation
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
bug topic-configuration topic-error-reporting
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
zostera/django-bootstrap4#894 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
use-agent-os/agent-os#3276 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
zephyrproject-rtos/zephyr#119726 ·
-
area/auth bug comp/agent P3 platform/discord type/security
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
NousResearch/hermes-agent#117848 ·