Skip to content

type-arg errors are over a larger node than necessary #18531

Closed
@A5rocks

Description

@A5rocks

Bug Report

Inspired by #18530, I tried using --pretty on a file with [type-arg]. Unfortunately the output isn't immediately understandable.

To Reproduce

import typing

x: typing.List[typing.List[int, int]] = []

Expected Behavior

repro.py:3: error: "list" expects 1 type argument, but 2 given  [type-arg]
    x: typing.List[typing.List[int, int]] = []
                   ^~~~~~~~~~~~~~~~~~~~~
Found 1 error in 1 file (checked 1 source file)

Actual Behavior

repro.py:3: error: "list" expects 1 type argument, but 2 given  [type-arg]
    x: typing.List[typing.List[int, int]] = []
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Found 1 error in 1 file (checked 1 source file)

Your Environment

  • Mypy version used: v1.14.1
  • Mypy command-line flags: --warn-unreachable
  • Mypy configuration options from mypy.ini (and other config files): none, I think
  • Python version used: 3.13.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions