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

Unexpected "..." when assigning tuple with variable length to type alias #11102

Closed
DetachHead opened this issue Sep 14, 2021 · 2 comments
Closed
Labels
bug mypy got something wrong

Comments

@DetachHead DetachHead added the bug mypy got something wrong label Sep 14, 2021
@Zeckie
Copy link

Zeckie commented Sep 15, 2021

This is valid (according to mypy):

from typing import Tuple
Foo = Tuple[int, ...]
a: Foo = (1 ,2, 3)

reveal_type(a) # note: Revealed type is "builtins.tuple[builtins.int]"

Is it that mypy can't tell whether tuple is being used as a type or a function?

from typing import Tuple
reveal_type(Tuple[int]) # note: Revealed type is "builtins.object"
reveal_type(tuple[int]) # note: Revealed type is "def (iterable: typing.Iterable[builtins.int*] =) -> builtins.tuple[builtins.int*]" 

@hauntsaninja
Copy link
Collaborator

I believe this was fixed (a while back) on master #10766

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug mypy got something wrong
Projects
None yet
Development

No branches or pull requests

3 participants