Skip to content

Better message if method incompatible with base class #3379

@JukkaL

Description

@JukkaL

Currently if a method is incompatible with a base class, mypy just tells the name of the base class but doesn't actually give more details about the expected signature. This is a problem especially if the base class is defined in typeshed, since users may not know how to find the signature. There are a few things we could do about this:

  1. Display the base class method signature as a note after the message.
  2. Give a pointer to the file and line number where the base class method is defined.
  3. Also highlight common specific issues with specialized messages, such as different number of arguments, argument type is narrower in subclass, etc.
  4. Some combination (or all) of the above.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions