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

Regression in 1.1.218 involving recursive types in tuples #2998

Closed
rsokl opened this issue Feb 6, 2022 · 2 comments
Closed

Regression in 1.1.218 involving recursive types in tuples #2998

rsokl opened this issue Feb 6, 2022 · 2 comments
Labels
addressed in next version Issue is fixed and will appear in next published version bug Something isn't working

Comments

@rsokl
Copy link

rsokl commented Feb 6, 2022

The following false-negative occurs in pyright 1.1.218

from typing import Union, Tuple

A = Union[str, int]
B = Union[A, Tuple["B", ...]]

class M:
    pass

def g(x: B):
    return


# (pyright 1.1.217) error: Argument of type "tuple[Literal[1], M]" cannot be assigned to parameter "x" of type "B"
# (pyright 1.1.218) no error
g((1, M())) 
@rsokl rsokl changed the title Regression in 1.1.218 dealing with recursive types Regression in 1.1.218 involving recursive types Feb 6, 2022
@rsokl rsokl changed the title Regression in 1.1.218 involving recursive types Regression in 1.1.218 involving recursive types in tuples Feb 6, 2022
@erictraut
Copy link
Collaborator

Thanks for catching this. A bug fix that I introduced in 1.1.218 uncovered a latent bug that affected the evaluation of tuples, and this particular case triggers it. I also didn't have any unit tests in place for recursive tuples, so the tests didn't detect this.

I've fixed the bug and added a new unit test based on your example. The fix will be in the next release.

@erictraut erictraut added addressed in next version Issue is fixed and will appear in next published version bug Something isn't working labels Feb 6, 2022
@erictraut
Copy link
Collaborator

This is addressed in pyright 1.1.219, which I just published. It will also be in the next 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

2 participants