Overload evaluation does not conform to typing spec
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 15.6k
- Forks
- 1.8k
- Avg merge
- 12h 13m
- Merged PRs (30d)
- 52
Description
A recent addition to the typing spec conformance test uncovered a case that pyright is handling incorrectly.
This is found in the `overloads_evaluation.py` test in [this PR](https://github.com/python/typing/pull/1957).
```python
@overload
def example5(obj: list[int]) -> list[int]: ...
@overload
def example5(obj: list[str]) -> list[str]: ...
def example5(obj: Any) -> list[Any]:
return []
def check_example5(b: list[Any]) -> None:
assert_type(example5(b), Any)
```
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.
Research direction
Start with the overloads_evaluation.py conformance test referenced in the issue and inspect how pyright evaluates example5 with list[Any]. Compare the result with the typing specification and the linked typing conformance PR. The work is done when the test's assert_type(example5(b), Any) expectation passes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100