From 3886d5b4c6642342addf4190e1a2076b073ceb33 Mon Sep 17 00:00:00 2001 From: adrew Date: Tue, 18 Jan 2022 13:12:01 +0300 Subject: [PATCH] Add test for high order function arg inference in class context --- tests/CallableTest.php | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/tests/CallableTest.php b/tests/CallableTest.php index 05fc088be..e23e207f3 100644 --- a/tests/CallableTest.php +++ b/tests/CallableTest.php @@ -262,6 +262,39 @@ class CallableTest extends TestCase '$result' => 'list', ], ], + 'inferTemplateOfHighOrderFunctionArgByPreviousArgInClassContext' => [ + ' + */ + public function map(callable $ab) { throw new RuntimeException("???"); } + } + + /** + * @return ArrayList + */ + function getList() { throw new RuntimeException("???"); } + + /** + * @template T + * @return Closure(T): T + */ + function id() { throw new RuntimeException("???"); } + + $result = getList()->map(id()); + ', + 'assertions' => [ + '$result' => 'ArrayList', + ], + ], 'inferPipelineWithPartiallyAppliedFunctions' => [ '