Skip to content

Commit 46eb516

Browse files
authored
Add test case for non callable operator with getattr (#11637)
Co-authored-by: hauntsaninja <>
1 parent 4f59ca4 commit 46eb516

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

test-data/unit/check-overloading.test

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5396,14 +5396,27 @@ def f_d(arg: str) -> None: ...
53965396
@dec_d # E: "int" not callable
53975397
def f_d(arg): ...
53985398

5399-
Bad = TypeVar('Good') # type: ignore
5399+
Bad1 = TypeVar('Good') # type: ignore
54005400

5401-
def dec_e(f: Bad) -> Bad: ... # type: ignore
5401+
def dec_e(f: Bad1) -> Bad1: ... # type: ignore
54025402

54035403
@overload
54045404
def f_e(arg: int) -> None: ...
54055405
@overload
54065406
def f_e(arg: str) -> None: ...
5407-
@dec_e # E: Bad? not callable
5407+
@dec_e # E: Bad1? not callable
54085408
def f_e(arg): ...
5409+
5410+
class Bad2:
5411+
def __getattr__(self, attr):
5412+
if attr == "__call__":
5413+
return lambda *a, **kw: print(a, kw)
5414+
raise AttributeError
5415+
5416+
@overload
5417+
def f_f(arg: int) -> None: ...
5418+
@overload
5419+
def f_f(arg: str) -> None: ...
5420+
@Bad2() # E: "Bad2" not callable
5421+
def f_f(arg): ...
54095422
[builtins fixtures/dict.pyi]

0 commit comments

Comments
 (0)