Skip to content

Unexpected "Type application has too many types" #12966

Not planned
@arnimarj

Description

@arnimarj

Bug Report

I'm not sure if this is related to #12211, but I have this simple example:

from typing import Tuple, TypeAlias


class Foo:
	...


_A: TypeAlias = Foo | None | Tuple[str, str]
_B: TypeAlias = Foo | None | tuple[str, str]
_C = Foo | None | Tuple[str, str]
_D = Foo | None | tuple[str, str]

...which fails.

To Reproduce

Run the above using mypy --strict alias.py.

I tried both 0.961 and 0.970-dev using Python 3.10.5. I get these errors:

$ mypy --strict alias.py 
alias.py:9: error: Type application has too many types (1 expected)
alias.py:11: error: Type application has too many types (1 expected)
Found 2 errors in 1 file (checked 1 source file)

Your Environment

This was run on Ubuntu 22.04, Python 3.10.5, and mypy 0.961 and 0.970-dev

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugmypy got something wrongtopic-pep-585PEP 585 (builtin generics)topic-pep-604PEP 604 (union | operator)topic-type-aliasTypeAlias and other type alias issues

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @arnimarj@AlexWaygood

        Issue actions

          Unexpected "Type application has too many types" · Issue #12966 · python/mypy