Skip to content

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

Closed

Activity

  1. Zeckie commented on Sep 15, 2021

    @Zeckie

    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*]" 
  2. hauntsaninja commented on Sep 21, 2021

    @hauntsaninja
    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugmypy got something wrong

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions