use union of overload signatures return types as inferred return type for unannotated impl
Open
needs-discussion
overloads
typechecking
- Dominant language
- Rust
- Stars
- 7k
- Forks
- 516
- PR merge metrics
- No merged PRs in 30d
Description
### Describe the Bug
```py
from typing import overload
@overload
def foo(i: str) -> list[object]: ... # Overload return type `list[object]` is not assignable to implementation return type `list[int]`
@overload
def foo(i: int) -> list[object]: ... # Overload return type `list[object]` is not assignable to implementation return type `list[int]`
def foo(i):
# bonus: reveal_type(i) should be `str | int`
return [1]
```
here we could infer `list[object]` and not see any error
Contributor guide
Assessment
This issue has not been assessed yet.