Using type application with a function call gets a wrong error message
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 20.6k
- Forks
- 3.3k
- PR merge metrics
- PR metrics pending
Description
*Notes:
- mypy test.py
- mypy 1.19.1
- Python 3.14.0
Using type application with a function call gets the error message as shown below:
def func[T](x: T) -> T:
return x
func[int](100) # Error
error: Type application is only supported for generic classes
But type application is also supported for generic type aliases as shown below:
type TA[T] = list[T]
v: TA[int] # No error
So the error message should be as shown below:
error: Type application is only supported for generic classes and type aliases
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
Reproduce the report with the generic function and type-alias examples in test.py by running mypy test.py. Find the diagnostic that reports type applications as supported only for generic classes, then update its wording to include type aliases and add regression coverage showing the expected message.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100