Skip to content

Dict constructor with unknown base class #1363

Closed
@drewhaven

Description

@drewhaven

Consider the following:

from typing import Any, Dict
from base import Base

class Derived(Base):
    def to_dict(self) -> Dict[str, Any]:
        return dict(self)

When we run mypy with --slient-imports on only this file, we get the following error:

note: In member "to_dict" of class "Derived":
error: No overload variant of "dict" matches argument types [test_mypy_dict.Derived]

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugmypy got something wrong

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions