basedmypy icon indicating copy to clipboard operation
basedmypy copied to clipboard

Modules don't really conform to `protocol`s

Open KotlinIsland opened this issue 1 year ago • 0 comments

test.py

from typing import Protocol

import test2

class P(Protocol):
    def foo(self) -> None: ...

a: P = test2
reveal_type(type(a).foo)  # Revealed type is "def (self: test.P) -> None"

test2.py

def foo() -> None: ...

upstream: https://github.com/python/mypy/issues/16890

KotlinIsland avatar Feb 11 '24 11:02 KotlinIsland