File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -1072,15 +1072,23 @@ match m:
1072
1072
[case testMatchClassPatternCallable]
1073
1073
from typing import Callable
1074
1074
1075
+ class FnImpl:
1076
+ def __call__(self, x: object, /) -> int: ...
1077
+
1075
1078
def test_object(x: object) -> None:
1076
1079
match x:
1077
1080
case Callable() as fn:
1078
1081
reveal_type(fn) # N: Revealed type is "def (*Any, **Any) -> Any"
1079
1082
1080
- def test_impl(x: Callable[[int], int]) -> None:
1083
+ def test_impl(x: FnImpl) -> None:
1084
+ match x:
1085
+ case Callable() as fn:
1086
+ reveal_type(fn) # N: Revealed type is "__main__.FnImpl"
1087
+
1088
+ def test_callable(x: Callable[[object], int]) -> None:
1081
1089
match x:
1082
1090
case Callable() as fn:
1083
- reveal_type(fn) # N: Revealed type is "def (builtins.int ) -> builtins.int"
1091
+ reveal_type(fn) # N: Revealed type is "def (builtins.object ) -> builtins.int"
1084
1092
1085
1093
1086
1094
[case testMatchClassPatternCallbackProtocol]
You can’t perform that action at this time.
0 commit comments