Type inference bug with self-application of a generic function containing `ParamSpec`
Open
bug
- Dominant language
- Python
- Stars
- 15.6k
- Forks
- 1.8k
- Avg merge
- 12h 13m
- Merged PRs (30d)
- 52
Description
**Describe the bug**
In the following example, pyright doesn't correctly "freshen" the ParamSpec `P` resulting in a partially unknown type.
**Code or Screenshots**
```python
from collections.abc import Callable
def id[**P, R](c: Callable[P, R]) -> Callable[P, R]: ...
reveal_type(id(id))
# (c: (...) -> Unknown) -> ((**P(1)@id) -> R(1)@id)
```
Contributor guide
Research direction
Start by running the provided generic-function self-application example and inspecting the type-inference handling for ParamSpec freshening. Confirm the current reveal_type output, then verify that self-application no longer leaves a partially unknown type.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100