Skip to content

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

Closed
@tayler6000

Description

@tayler6000

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)

Activity

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.[/+] on Apr 16, 2022
JelleZijlstra

JelleZijlstra commented on Apr 16, 2022

@JelleZijlstra
Member

Duplicate of #11098

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 wrongtopic-pep-604PEP 604 (union | operator)

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @JelleZijlstra@tayler6000

        Issue actions

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