Skip to content

Using a type alias with arguments in case block in a match statement gets the wrong error message with parameters instead of arguments #20495

@hyperkai

Description

@hyperkai

*Memo:

  • mypy test.py
  • mypy 1.19.1
  • Python 3.14
  • Windows 11

Using a type alias with arguments in case block in a match statement gets the wrong error message with parameters instead of arguments as shown below:

class Cls:
    def __init__(self, x: int, y: int):
        self.x = x
        self.y = y

type TA = Cls

match Cls(x=10, y=20):
    case TA(x=10, y=20):
        print("OK")

error: Class pattern class must not be a type alias with type parameters

So, the error message should be with arguments instead of parameters as shown below:

error: Class pattern class must not be a type alias with type arguments

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugmypy got something wrongtopic-match-statementPython 3.10's match statement

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions