Skip to content

Unexpected '...' in standard tuple #9459

@frost-nzcr4

Description

@frost-nzcr4

Bug Report

To Reproduce

from __future__ import annotations

from typing import Tuple


# Standard tuple
tuple_1: tuple[str, str, str] = ("b", "c", "d")
# error: Unexpected '...'  [misc]
tuple_2_err: tuple[str, ...] = ("b", "c")
# error: Unexpected '...'  [misc]
# error: Dict entry 0 has incompatible type "str": "Tuple[str, str, str]"; expected "str": "Tuple[str, Any]"  [dict-item]
tuple_3_err: tuple[str, ...] = ("b", "c", "d")

dict_with_tuple_1: dict[str, tuple[str, str, str]] = {"a": ("b", "c", "d")}
# error: Unexpected '...'  [misc]
dict_with_tuple_2_err: dict[str, tuple[str, ...]] = {"a": ("b", "c")}
# error: Unexpected '...'  [misc]
# error: Dict entry 0 has incompatible type "str": "Tuple[str, str, str]"; expected "str": "Tuple[str, Any]"  [dict-item]
dict_with_tuple_3_err: dict[str, tuple[str, ...]] = {"a": ("b", "c", "d")}

# typing.Tuple
tuple_10: Tuple[str, str, str] = ("b", "c", "d")
tuple_20: Tuple[str, ...] = ("b", "c")
tuple_30: Tuple[str, ...] = ("b", "c", "d")

dict_with_tuple_10: dict[str, Tuple[str, str, str]] = {"a": ("b", "c", "d")}
dict_with_tuple_20: dict[str, Tuple[str, ...]] = {"a": ("b", "c")}
dict_with_tuple_30: dict[str, Tuple[str, ...]] = {"a": ("b", "c", "d")}

Expected Behavior

I've expected that tuple and typing.Tuple works the same and errors will not occurs.

Actual Behavior

Standard tuple have got error: Unexpected '...' [misc]

Your Environment

  • Mypy version used: 0.790+dev.44a96876c9f2303af8258532f99cd821a98112dc
  • Mypy command-line flags: --ignore-missing-imports --show-error-codes
  • Mypy configuration options from mypy.ini (and other config files):
  • Python version used: Python 3.9.0rc2
  • Operating system and version: docker FROM python:3.9-rc-buster

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