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:
10721072[case testMatchClassPatternCallable]
10731073from typing import Callable
10741074
1075+ class FnImpl:
1076+ def __call__(self, x: object, /) -> int: ...
1077+
10751078def test_object(x: object) -> None:
10761079 match x:
10771080 case Callable() as fn:
10781081 reveal_type(fn) # N: Revealed type is "def (*Any, **Any) -> Any"
10791082
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:
10811089 match x:
10821090 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"
10841092
10851093
10861094[case testMatchClassPatternCallbackProtocol]
You can’t perform that action at this time.
0 commit comments