(🐞) List literals are accepted as valid types when applying a `ParamSpec`
P = ParamSpec("P")
T = TypeVar("T")
class C(Generic[P]): ...
class G(Generic[T]): ...
C[[[int]]] # no error # C[[[int]]]
G[[[int]]] # error
I would consider these to be a bug as well:
reveal_type(C[int]) # Revealed type is "C[[builtins.int]]"
reveal_type(C[int, bytes, float]) # Revealed type is "C[[builtins.int, builtins.bytes, builtins.float]]"
There should always be exactly one list literal to do type application.
Nevermind, the PEP 612 actually says that C[int, bytes, float] should be fine for C[P] for readability reasons. While I feel like that's kind of ok, I feel like it's very strange that:
class D[P, T]: ...
# Fails:
D[int, bytes, str]
# Works
D[int, bytes] # Type is D[[int, bytes]]
I feel like at least the latter is an extremely weird case and should probably be rejected by the type checker, because it feels ambiguous.
@davidhalter You might have already made an issue (I haven't checked) but if not, could you make a new one?
The original case in this issue is now passing as of mypy v1: https://mypy-play.net/?mypy=latest&python=3.11&gist=a0e33483038f95c43a7b6e99fec355df
See #14799.