Skip to content

Commit 3027cd6

Browse files
authored
Use analyze_member_access instead of find_member (#11638)
1 parent ee8a5ca commit 3027cd6

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

mypy/checker.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,17 @@ def check_overlapping_overloads(self, defn: OverloadedFuncDef) -> None:
512512
impl_type = inner_type
513513
elif isinstance(inner_type, Instance):
514514
inner_call = get_proper_type(
515-
find_member('__call__', inner_type, inner_type, is_operator=True)
515+
analyze_member_access(
516+
name='__call__',
517+
typ=inner_type,
518+
context=defn.impl,
519+
is_lvalue=False,
520+
is_super=False,
521+
is_operator=True,
522+
msg=self.msg,
523+
original_type=inner_type,
524+
chk=self,
525+
),
516526
)
517527
if isinstance(inner_call, CallableType):
518528
impl_type = inner_call

test-data/unit/check-overloading.test

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5409,6 +5409,7 @@ def f_e(arg): ...
54095409

54105410
class Bad2:
54115411
def __getattr__(self, attr):
5412+
# __getattr__ is not called for implicit `__call__`
54125413
if attr == "__call__":
54135414
return lambda *a, **kw: print(a, kw)
54145415
raise AttributeError

0 commit comments

Comments
 (0)