KotlinIsland / KotlinIsland/basedmypy

Overload/subtype incompatibility should say why it's incompatible, especially related to default(optional) parameters

Open
#329 0 comments 0 reactions 0 assignees View on GitHub
feature understandability
Dominant language
Python
Stars
202
Forks
6
PR merge metrics
No merged PRs in 30d

Description

```py
from typing import overload

@overload
def foo(a: int=...): ...
@overload
def foo(a: str): ...
def foo(a: object):
print(a)
```
```
test.py:7:1: error: Overloaded function implementation does not accept all possible arguments of signature 1 [misc]
```
ummm, why?

what about:
```
test.py:7:1: error: Overloaded function implementation does not accept all possible arguments of signature 1 [misc]
test.py:7:1: note: parameter "a" is incompatible (it has a default value in the overload)
test.py:7:1: note: "foo()" is "type safe", but will result in a runtime error
```

Contributor guide

Open the contributing guide

Research direction

Reproduce the overload example in the issue with basedmypy and inspect the implementation-compatibility diagnostic path. Compare the current error with the requested explanation for the default parameter, then add or update focused diagnostic coverage so the reported incompatibility identifies why it occurs.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
devtools
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.