Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
A5rocks opened this issue Jan 25, 2025 · 0 comments · Fixed by #18533
Closed

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

A5rocks opened this issue Jan 25, 2025 · 0 comments · Fixed by #18533
Labels
bug mypy got something wrong topic-error-reporting How we report errors

Comments

@A5rocks
Copy link
Collaborator

A5rocks commented Jan 25, 2025

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
@A5rocks A5rocks added bug mypy got something wrong topic-error-reporting How we report errors labels Jan 25, 2025
@A5rocks A5rocks changed the title type-arg errors are over more text than they could be type-arg errors are over a larger node than necessary Jan 25, 2025
A5rocks added a commit to A5rocks/mypy that referenced this issue Jan 26, 2025
Specifically, this addresses python#18531
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug mypy got something wrong topic-error-reporting How we report errors
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant