Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pyright should reject *Ts as a type param in a TypeAliasType definition #7284

Closed
hamdanal opened this issue Feb 17, 2024 · 2 comments
Closed
Labels
addressed in next version Issue is fixed and will appear in next published version enhancement request New feature or request

Comments

@hamdanal
Copy link

It is not really called out in PEP 695 but it seems it should be rejected. Consider this example:

from typing_extensions import TypeAliasType, TypeVarTuple, Unpack

Ts = TypeVarTuple("Ts")

Alias1 = TypeAliasType("Alias1", tuple[*Ts], type_params=(Ts,))  # pyright: OK
Alias2 = TypeAliasType("Alias2", tuple[*Ts], type_params=(*Ts,))  # pyright: OK <- false negative?
Alias3 = TypeAliasType("Alias3", tuple[*Ts], type_params=(Unpack[Ts],))  # pyright: Error

I noticed this while adding support to TypeAliasType in mypy python/mypy#16926 which in its current state rejects Alias2 and Alias3 above while pyright only emits an error on Alias3 usage.

versions:
pyright 1.1.350
python 3.11

@hamdanal hamdanal added the enhancement request New feature or request label Feb 17, 2024
erictraut added a commit that referenced this issue Feb 17, 2024
… within a TypeAliasType type parameter list. This addresses #7284.
@erictraut
Copy link
Collaborator

Thanks for filing the issue. I agree this is a false negative condition.

It will be addressed in the next release.

@erictraut erictraut added the addressed in next version Issue is fixed and will appear in next published version label Feb 17, 2024
@erictraut
Copy link
Collaborator

This is addressed in pyright 1.1.351, which I just published.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
addressed in next version Issue is fixed and will appear in next published version enhancement request New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants