KotlinIsland / KotlinIsland/basedmypy

Tighten overload impl return type

Open
#259 5 comments 0 reactions 0 assignees View on GitHub
feature p-1
Dominant language
Python
Stars
202
Forks
6
PR merge metrics
No merged PRs in 30d

Description

```py
@overload
def foo(a: int) -> int: ...
@overload
def foo(a: str) -> str: ...
def foo(a: object) -> object:
return object()
```

I think that the return type shouldn't be completely unchecked, it should be a union of the overloads return types or narrower.

The true form of the return type _isn't_ an intersection, it's actually wider than that. It's a conditional type based on the overloads.

Contributor guide

Open the contributing guide

Research direction

No files or tests are named. Start by locating the overload implementation return-type checking, then determine how overload return types should constrain the implementation and how conditional behavior is represented; done means incompatible implementation returns are rejected while valid narrower returns remain accepted.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.