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

Union of unpacked TypeVarTuple should evaluate to Never for empty TypeVarTuple #4739

Closed
erictraut opened this issue Mar 6, 2023 · 1 comment
Labels
addressed in next version Issue is fixed and will appear in next published version bug Something isn't working

Comments

@erictraut
Copy link
Collaborator

erictraut commented Mar 6, 2023

from typing import Generic, TypeVarTuple, Union

Ts = TypeVarTuple("Ts")

class ClassA(Generic[*Ts]):
    def __init__(self, *args: *Ts):
        ...

    def foo(self) -> Union[*Ts]:
        ...

x = ClassA()
y = x.foo()
reveal_type(y, expected_text="Never")
@erictraut erictraut added bug Something isn't working addressed in next version Issue is fixed and will appear in next published version labels Mar 6, 2023
erictraut pushed a commit that referenced this issue Mar 6, 2023
…on or method that returns `Union[*Ts]` where `Ts` is a TypeVarTuple bound to `*tuple[()]`. This addresses #4739.
@erictraut
Copy link
Collaborator Author

This is addressed in pyright 1.1.297, which I just published. It will also be included in a future release of pylance.

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 bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant