Skip to content

Support for call-overload errors #44

@ollij93

Description

@ollij93

For a "[call-overload]" error mypy raises an error and multiple note messages.
Since we can't test for multiple messages on the same line its currently not possible to successfully test for call-overload errors.

Example:

field: str = dataclasses.field(default="A", default_factory=lambda: "B") # E: [call-overload]

The error message is being tested for correctly, but there are multiple notes which cause the test to fail:

  A: note: Possible overload variants:
  A: note: def [_T] field(*, default: _T, init: bool = ..., repr: bool = ..., hash: bool | None = ..., compare: bool = ..., metadata: Mapping[Any, Any] | None = ..., kw_only: bool = ...) -> _T
  A: note: def [_T] field(*, default_factory: Callable[[], _T], init: bool = ..., repr: bool = ..., hash: bool | None = ..., compare: bool = ..., metadata: Mapping[Any, Any] | None = ..., kw_only: bool = ...) -> _T
  A: note: def field(*, init: bool = ..., repr: bool = ..., hash: bool | None = ..., compare: bool = ..., metadata: Mapping[Any, Any] | None = ..., kw_only: bool = ...) -> Any

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions