You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Generic type aliases where one of the free "type variables" is a ParamSpec don't work.
To Reproduce
test.py:
from typing import Callable, TypeVar
from typing_extensions import ParamSpec
P = ParamSpec("P")
R = TypeVar("R")
FunctionType = Callable[P, R]
def a_decorator(func: FunctionType[[int], str]) -> None:
...
mypy test.py
Expected Behavior
This should not raise any errors. A similar example. where both type variables are actual TypeVars, works:
from typing import Dict, TypeVar
K = TypeVar("K")
V = TypeVar("V")
DictType = Dict[K, V]
def a_function(d: DictType[int, str]) -> None:
...
Actual Behavior
Output:
test.py:9: error: The first argument to Callable must be a list of types or "..."
test.py:12: error: Bracketed expression "[...]" is not valid as a type
test.py:12: note: Did you mean "List[...]"?
test.py:12: error: Bad number of arguments for type alias, expected: 0, given: 2
Your Environment
Mypy version used: 0.950
Mypy command-line flags: none
Mypy configuration options from mypy.ini (and other config files): none
Python version used: 3.7.11
Operating system and version: macOS 12.3.1
The text was updated successfully, but these errors were encountered:
Bug Report
Generic type aliases where one of the free "type variables" is a
ParamSpec
don't work.To Reproduce
test.py
:mypy test.py
Expected Behavior
This should not raise any errors. A similar example. where both type variables are actual
TypeVars
, works:Actual Behavior
Output:
Your Environment
mypy.ini
(and other config files): noneThe text was updated successfully, but these errors were encountered: