Skip to content

Commit

Permalink
Use analyze_member_access instead of find_member (#11638)
Browse files Browse the repository at this point in the history
  • Loading branch information
sobolevn authored Dec 1, 2021
1 parent ee8a5ca commit 3027cd6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
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

0 comments on commit 3027cd6

Please sign in to comment.