Skip to content

Using type application with a function call gets a wrong error message #20927

@hyperkai

Description

@hyperkai

*Notes:

  • mypy test.py
  • mypy 1.19.1
  • Python 3.14.0

Using type application with a function call gets the error message as shown below:

def func[T](x: T) -> T:
    return x

func[int](100) # Error

error: Type application is only supported for generic classes

But type application is also supported for generic type aliases as shown below:

type TA[T] = list[T]

v: TA[int] # No error

So the error message should be as shown below:

error: Type application is only supported for generic classes and type aliases

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions