Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion mypy/checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,17 @@ def check_overlapping_overloads(self, defn: OverloadedFuncDef) -> None:
impl_type = inner_type
elif isinstance(inner_type, Instance):
inner_call = get_proper_type(
find_member('__call__', inner_type, inner_type, is_operator=True)
analyze_member_access(
name='__call__',
typ=inner_type,
context=defn.impl,
is_lvalue=False,
is_super=False,
is_operator=True,
msg=self.msg,
original_type=inner_type,
chk=self,
),
)
if isinstance(inner_call, CallableType):
impl_type = inner_call
Expand Down
1 change: 1 addition & 0 deletions test-data/unit/check-overloading.test
Original file line number Diff line number Diff line change
Expand Up @@ -5409,6 +5409,7 @@ def f_e(arg): ...

class Bad2:
def __getattr__(self, attr):
# __getattr__ is not called for implicit `__call__`
if attr == "__call__":
return lambda *a, **kw: print(a, kw)
raise AttributeError
Expand Down