Skip to content

Callable ClassVar is incorrectly treated as a method #11077

Description

@NeilGirdhar
from typing import Callable, MutableMapping, ClassVar

class C:
    x: ClassVar[Callable[[], MutableMapping]] = dict
    def f(self) -> MutableMapping:
        return self.x()  

c = C()
print(c.f())

Gives

a.py:6: error: Attribute function "x" with type "Callable[[], MutableMapping[Any, Any]]" does not accept self argument

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