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

false positive "error: Type application has too many types (1 expected)" when using pipe instead of Union for type alias. #12604

Closed
tayler6000 opened this issue Apr 16, 2022 · 1 comment
Labels
bug mypy got something wrong topic-pep-604 PEP 604 (union | operator)

Comments

@tayler6000
Copy link

tayler6000 commented Apr 16, 2022

Bug Report

When using a pipe to create a type alias error: Type application has too many types (1 expected) is raised. This is not the case if you use a Union.

To Reproduce/Actual Behavior

from typing import Union


type_alias1= tuple[int, int, int] |  int  # error: Type application has too many types (1 expected)
type_alias2 = Union[tuple[int, int, int], int]  # passes type check

My Environment

  • Mypy versions used: 0.960+dev.10ba5c1aa14e01be1cfacb322136e22751617d26, and 0.942
  • Python version used: Python 3.10.2
  • Operating system and version: Windows 10 Home (21H2)
@tayler6000 tayler6000 added the bug mypy got something wrong label Apr 16, 2022
@tayler6000 tayler6000 changed the title false positive "error: Type application has too many types (1 expected)" when using pipe instead of Union for TypeAlias.. false positive "error: Type application has too many types (1 expected)" when using pipe instead of Union for type alias. Apr 16, 2022
@JelleZijlstra JelleZijlstra added the topic-pep-604 PEP 604 (union | operator) label Apr 16, 2022
@JelleZijlstra
Copy link
Member

Duplicate of #11098

@JelleZijlstra JelleZijlstra marked this as a duplicate of #11098 Apr 16, 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-604 PEP 604 (union | operator)
Projects
None yet
Development

No branches or pull requests

2 participants