-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Closed
Labels
bugmypy got something wrongmypy got something wrongtopic-callsFunction calls, *args, **kwargs, defaultsFunction calls, *args, **kwargs, defaultstopic-overlapOverlapping equality checkOverlapping equality check
Description
Running this code:
from typing import Any, Callable
class Foo:
def __init__(self, a: int) -> None:
print(a)
def bar(f: Callable[[Any], Any]) -> None:
if type(f) ==Foo:
print("The same!")
f(3)
bar(Foo)
with mypy 0.942 and "strict_equality" enabled leads to:
error: Non-overlapping equality check (left operand type: "Type[Callable[[Any], Any]]", right operand type: "Type[Foo]")
I think this is wrong, as clearly, mypy accepts Foo as a correct argument to bar, in which case checking if f inside the function is of type Foo should also be valid...
Metadata
Metadata
Assignees
Labels
bugmypy got something wrongmypy got something wrongtopic-callsFunction calls, *args, **kwargs, defaultsFunction calls, *args, **kwargs, defaultstopic-overlapOverlapping equality checkOverlapping equality check