@@ -1091,15 +1091,23 @@ from typing_extensions import Protocol, runtime_checkable
1091
1091
class FnProto(Protocol):
1092
1092
def __call__(self, x: int, /) -> object: ...
1093
1093
1094
+ class FnImpl:
1095
+ def __call__(self, x: object, /) -> int: ...
1096
+
1094
1097
def test_object(x: object) -> None:
1095
1098
match x:
1096
1099
case FnProto() as fn:
1097
1100
reveal_type(fn) # N: Revealed type is "__main__.FnProto"
1098
1101
1099
- def test_impl(x: Callable[[int], int] ) -> None:
1102
+ def test_impl(x: FnImpl ) -> None:
1100
1103
match x:
1101
1104
case FnProto() as fn:
1102
- reveal_type(fn) # N: Revealed type is "def (builtins.int) -> builtins.int"
1105
+ reveal_type(fn) # N: Revealed type is "__main__.FnImpl"
1106
+
1107
+ def test_callable(x: Callable[[object], int]) -> None:
1108
+ match x:
1109
+ case FnProto() as fn:
1110
+ reveal_type(fn) # N: Revealed type is "def (builtins.object) -> builtins.int"
1103
1111
1104
1112
[builtins fixtures/dict.pyi]
1105
1113
@@ -1111,15 +1119,23 @@ from typing_extensions import Protocol, runtime_checkable
1111
1119
class AnyCallable(Protocol):
1112
1120
def __call__(self, *args: Any, **kwargs: Any) -> Any: ...
1113
1121
1122
+ class FnImpl:
1123
+ def __call__(self, x: object, /) -> int: ...
1124
+
1114
1125
def test_object(x: object) -> None:
1115
1126
match x:
1116
1127
case AnyCallable() as fn:
1117
1128
reveal_type(fn) # N: Revealed type is "__main__.AnyCallable"
1118
1129
1119
- def test_impl(x: Callable[[int], int] ) -> None:
1130
+ def test_impl(x: FnImpl ) -> None:
1120
1131
match x:
1121
1132
case AnyCallable() as fn:
1122
- reveal_type(fn) # N: Revealed type is "def (builtins.int) -> builtins.int"
1133
+ reveal_type(fn) # N: Revealed type is "__main__.FnImpl"
1134
+
1135
+ def test_callable(x: Callable[[object], int]) -> None:
1136
+ match x:
1137
+ case AnyCallable() as fn:
1138
+ reveal_type(fn) # N: Revealed type is "def (builtins.object) -> builtins.int"
1123
1139
1124
1140
[builtins fixtures/dict.pyi]
1125
1141
0 commit comments