generics used in type aliases incorrectly cause `Expression type contains "Any"` error
Open
Nobody has claimed this yet.
bug
topic-disallow-any
topic-type-alias
- Dominant language
- Python
- Stars
- 20.6k
- Forks
- 3.3k
- PR merge metrics
- PR metrics pending
Description
from typing import _T as T, Generic
class A(Generic[T]):...
NG = A[T] # error: Expression type contains "Any" (has type "Type[A[Any]]") [misc]
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 by reproducing the minimal Python example in the linked mypy-play playground and inspect how the generic type alias is analyzed. Trace why A[T] becomes Type[A[Any]], then add a regression test showing that the valid alias no longer triggers the Expression type contains "Any" error.
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
- 45/100