Skip to content

mypy should use List when complaining about issues with the List type, instead of list #18530

Open
@hamirmahal

Description

@hamirmahal

Bug Report

mypy should use List when surfacing errors with the List type, not list.

It's confusing to engineers if mypy uses list when complaining about a type error because then engineers are searching the source code for occurrences of list, when the problem is actually with the usage of List.

To Reproduce

        self.orders: typing.List[typing.List[int, int]] = []

Expected Behavior

mypy should complain with

error: "List" expects 1 type argument, but 2 given  [type-arg]

Actual Behavior

mypy actually complains with

error: "list" expects 1 type argument, but 2 given  [type-arg]

Your Environment

  • Mypy version used: mypy==1.10.0
  • Mypy command-line flags: n/a
  • Mypy configuration options from mypy.ini (and other config files): n/a
  • Python version used: Python 3.10.12

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions