-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Closed
Closed
Copy link
Labels
bugmypy got something wrongmypy got something wrong
Description
Bug Report
The type typing.Tuple[Foo, ...] is accepted as meaning "tuple of Foo, arbitrary length", but tuple[Foo, ...] is not, in the context of type aliases. It's apparently understood, but produces an error message anyway.
To Reproduce
Create a file:
from typing import Tuple
IntsA = Tuple[int, ...]
IntsB = tuple[int, ...]
def foo(inputs: tuple[int, ...]) -> IntsB:
return inputs
Then run mypy on the file.
Actual Behavior
mypy reports: test.py:4: error: Unexpected '...'. It does not report an error on line 3 (alias defined from Tuple) or 5 (the same type provided directly as an annotation rather than an alias, and also the use of the alias which produced an error). If foo is defined as returning something that is not a tuple of integers, such as ("argle",), mypy does report that as an incompatible return value type.
Your Environment
- Mypy version used: 0.812
- Mypy command-line flags: None
- Mypy configuration options from
mypy.ini(and other config files): I have not set up such configuration - Python version used: 3.9.0
- Operating system and version: Arch Linux (linux 5.11.8-arch1-1)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugmypy got something wrongmypy got something wrong