Skip to content

mypy does not error when calling a TypeAliasType, if it refers to dict #19698

@sbrudenell

Description

@sbrudenell

Bug Report

If I declare a type with type T = dict, then instantiate it with T(), mypy does not error.

I spot-checked some other types like type T = set, type T = int etc, and mypy complains about these when called. Only type T = dict seems to wrongly pass.

To Reproduce

type T = dict
x: T = T()

Expected Behavior

$ mypy t.py
t.py:2: error: "TypeAliasType" not callable  [operator]
Found 1 error in 1 file (checked 1 source file)

Actual Behavior

$ mypy t.py
Success: no issues found in 1 source file

Your Environment

  • Mypy version used: mypy 1.17.1 (compiled: yes)
  • Mypy command-line flags: mypy
  • Mypy configuration options from mypy.ini (and other config files): None
  • Python version used: Python 3.13.5

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugmypy got something wrongtopic-pep-695Issues related to PEP 695 syntaxtopic-type-aliasTypeAlias and other type alias issues

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions