-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Open
Labels
bugmypy got something wrongmypy got something wrong
Description
from typing import Callable, _T as T
from types import FunctionType
class C:
def __init__(self, i: int=1): ...
def join(t1: T, t2: T) -> T: ...
c1: Callable[[], object] = C
c2: Callable[[int], object] = C
result = join(c1, c2)
reveal_type(result) # Revealed type is "builtins.function"
print(isinstance(result, FunctionType) # False
this is not an instance of builtins.function
, it is a type[C]
. it should be joined into a union, or something else, either object
or Callable[..., object]
or something
the same defect is observed with a non-function callable instance:
class C:
def __call__(self, i: int = 1): ...
- reraised from (🐞)
Callable
s are joined intobuiltins.function
#17017 as it wasn't resolved
DetachHead, robin-wayve and djcopley
Metadata
Metadata
Assignees
Labels
bugmypy got something wrongmypy got something wrong