@@ -1894,7 +1894,7 @@ reveal_type(apply_gen(Add5())) # N: Revealed type is "builtins.int"
18941894def apply_str(f: Callable[[str], int], x: str) -> int:
18951895 return f(x)
18961896apply_str(Add5(), 'a') # E: Argument 1 to "apply_str" has incompatible type "Add5"; expected "Callable[[str], int]" \
1897- # N: "Add5.__call__" has type "Callable[[Arg(int, 'x')], int] "
1897+ # N: "Add5.__call__" has type "def __call__(self, x: int) -> int"
18981898[builtins fixtures/isinstancelist.pyi]
18991899
19001900[case testMoreComplexCallableStructuralSubtyping]
@@ -1910,10 +1910,10 @@ class Bad1:
19101910class Bad2:
19111911 def __call__(self, y: int, *rest: str) -> int: pass
19121912call_soon(Good())
1913- call_soon(Bad1()) # E: Argument 1 to "call_soon" has incompatible type "Bad1"; expected "Callable[[ int, VarArg( str)], int] " \
1914- # N: "Bad1.__call__" has type "Callable[[Arg(int, 'x'), VarArg( int)], int] "
1915- call_soon(Bad2()) # E: Argument 1 to "call_soon" has incompatible type "Bad2"; expected "Callable[[ int, VarArg( str)], int] " \
1916- # N: "Bad2.__call__" has type "Callable[[Arg(int, 'y'), VarArg( str)], int] "
1913+ call_soon(Bad1()) # E: Argument 1 to "call_soon" has incompatible type "Bad1"; expected "def (x: int, * str) -> int" \
1914+ # N: "Bad1.__call__" has type "def __call__(self, x: int, *rest: int) -> int"
1915+ call_soon(Bad2()) # E: Argument 1 to "call_soon" has incompatible type "Bad2"; expected "def (x: int, * str) -> int" \
1916+ # N: "Bad2.__call__" has type "def __call__(self, y: int, *rest: str) -> int"
19171917[builtins fixtures/isinstancelist.pyi]
19181918
19191919[case testStructuralSupportForPartial]
@@ -2473,8 +2473,8 @@ def func(caller: Caller) -> None:
24732473 pass
24742474
24752475func(call)
2476- func(bad) # E: Argument 1 to "func" has incompatible type "Callable[[ int, VarArg( str)], None] "; expected "Caller" \
2477- # N: "Caller.__call__" has type "Callable[[Arg(str, 'x'), VarArg( int)], None] "
2476+ func(bad) # E: Argument 1 to "func" has incompatible type "def bad(x: int, *args: str) -> None"; expected "Caller" \
2477+ # N: "Caller.__call__" has type "def __call__(self, x: str, *args: int) -> None"
24782478[builtins fixtures/tuple.pyi]
24792479[out]
24802480
@@ -2512,7 +2512,7 @@ def func(caller: Caller) -> None:
25122512
25132513func(call)
25142514func(bad) # E: Argument 1 to "func" has incompatible type "Callable[[int], int]"; expected "Caller" \
2515- # N: "Caller.__call__" has type "Callable[[Arg(T, 'x')], T] "
2515+ # N: "Caller.__call__" has type "def [T] __call__(self, x: T) -> T "
25162516[builtins fixtures/tuple.pyi]
25172517[out]
25182518
@@ -2533,7 +2533,7 @@ def func(caller: Caller) -> None:
25332533
25342534func(call)
25352535func(bad) # E: Argument 1 to "func" has incompatible type "Callable[[T], tuple[T, T]]"; expected "Caller" \
2536- # N: "Caller.__call__" has type "Callable[[Arg(int, 'x')], int] "
2536+ # N: "Caller.__call__" has type "def __call__(self, x: int) -> int"
25372537[builtins fixtures/tuple.pyi]
25382538[out]
25392539
@@ -2573,8 +2573,8 @@ class Caller(Protocol):
25732573def bad(x: int, *args: str) -> None:
25742574 pass
25752575
2576- cb: Caller = bad # E: Incompatible types in assignment (expression has type "Callable[[ int, VarArg( str)], None] ", variable has type "Caller") \
2577- # N: "Caller.__call__" has type "Callable[[Arg(str, 'x'), VarArg( int)], None] "
2576+ cb: Caller = bad # E: Incompatible types in assignment (expression has type "def bad(x: int, *args: str) -> None", variable has type "Caller") \
2577+ # N: "Caller.__call__" has type "def __call__(self, x: str, *args: int) -> None"
25782578[builtins fixtures/tuple.pyi]
25792579[out]
25802580
@@ -2601,7 +2601,7 @@ def anon(caller: CallerAnon) -> None:
26012601
26022602func(call)
26032603func(bad) # E: Argument 1 to "func" has incompatible type "Callable[[str], None]"; expected "Caller" \
2604- # N: "Caller.__call__" has type "Callable[[Arg(str, 'x')], None] "
2604+ # N: "Caller.__call__" has type "def __call__(self, x: str) -> None"
26052605anon(bad)
26062606[out]
26072607
@@ -2625,7 +2625,7 @@ b: Bad
26252625
26262626func(a)
26272627func(b) # E: Argument 1 to "func" has incompatible type "Bad"; expected "One" \
2628- # N: "One.__call__" has type "Callable[[Arg(str, 'x')], None] "
2628+ # N: "One.__call__" has type "def __call__(self, x: str) -> None"
26292629[out]
26302630
26312631[case testJoinProtocolCallback]
@@ -3597,7 +3597,7 @@ test(C) # E: Argument 1 to "test" has incompatible type "type[C]"; expected "P"
35973597 # N: def __call__(x: int, y: int) -> Any \
35983598 # N: Got: \
35993599 # N: def __init__(x: int, y: str) -> C \
3600- # N: "P.__call__" has type "Callable[[Arg(int, 'x'), Arg( int, 'y')], Any] "
3600+ # N: "P.__call__" has type "def __call__(self, x: int, y: int) -> Any"
36013601
36023602[case testProtocolClassObjectPureCallback]
36033603from typing import Any, ClassVar, Protocol
@@ -3619,7 +3619,7 @@ test(C) # E: Argument 1 to "test" has incompatible type "type[C]"; expected "P"
36193619 # N: def __call__(x: int, y: int) -> Any \
36203620 # N: Got: \
36213621 # N: def __init__(x: int, y: str) -> C \
3622- # N: "P.__call__" has type "Callable[[Arg(int, 'x'), Arg( int, 'y')], Any] "
3622+ # N: "P.__call__" has type "def __call__(self, x: int, y: int) -> Any"
36233623[builtins fixtures/type.pyi]
36243624
36253625[case testProtocolClassObjectCallableError]
@@ -3642,7 +3642,7 @@ p: P = C # E: Incompatible types in assignment (expression has type "type[C]",
36423642 # N: def __call__(app: int) -> Callable[[str], None] \
36433643 # N: Got: \
36443644 # N: def __init__(app: str) -> C \
3645- # N: "P.__call__" has type "Callable[[Arg(int, ' app')], Callable[[str], None] ]"
3645+ # N: "P.__call__" has type "def __call__(self, app: int) -> Callable[[str], None]"
36463646
36473647[builtins fixtures/type.pyi]
36483648
@@ -3801,7 +3801,7 @@ def f_good(t: S) -> S:
38013801 return t
38023802
38033803g: C = f_bad # E: Incompatible types in assignment (expression has type "Callable[[int], int]", variable has type "C") \
3804- # N: "C.__call__" has type "Callable[[Arg(T, 't')], T] "
3804+ # N: "C.__call__" has type "def [T] __call__(self, t: T) -> T "
38053805g = f_good # OK
38063806
38073807[case testModuleAsProtocolImplementation]
0 commit comments