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

Can't alias a union of tuples #14132

Closed
dmoisset opened this issue Nov 18, 2022 · 1 comment
Closed

Can't alias a union of tuples #14132

dmoisset opened this issue Nov 18, 2022 · 1 comment
Labels
bug mypy got something wrong topic-pep-585 PEP 585 (builtin generics) topic-pep-604 PEP 604 (union | operator)

Comments

@dmoisset
Copy link
Contributor

Bug Report

When I create a type alias with a union of two tuple types, I get an error about the tuple type being applied to too many generic arguments.

To Reproduce

from typing import TypeAlias

mypair = tuple[int, int] | tuple[str, str]

https://mypy-play.net/?mypy=latest&python=3.10&gist=f2a322b4ac47de32fe0d3c06a2fa6fc8

Expected Behavior

The above program should type check correctly and define an alias

Actual Behavior

main.py:3: error: Type application has too many types (1 expected)  [misc]
Found 1 error in 1 file (checked 1 source file)

Your Environment

  • mypy 0.990
  • no command line flags
  • no configuration file
  • Python version used: 3.11
@dmoisset dmoisset added the bug mypy got something wrong label Nov 18, 2022
@AlexWaygood AlexWaygood added topic-pep-585 PEP 585 (builtin generics) topic-pep-604 PEP 604 (union | operator) labels Nov 18, 2022
@AlexWaygood
Copy link
Member

Duplicate of #11098

@AlexWaygood AlexWaygood marked this as a duplicate of #11098 Nov 18, 2022
@AlexWaygood AlexWaygood closed this as not planned Won't fix, can't repro, duplicate, stale Nov 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug mypy got something wrong topic-pep-585 PEP 585 (builtin generics) topic-pep-604 PEP 604 (union | operator)
Projects
None yet
Development

No branches or pull requests

2 participants