diff --git a/src/Psalm/Type/Union.php b/src/Psalm/Type/Union.php index fd9a9681d..f4394ca6e 100644 --- a/src/Psalm/Type/Union.php +++ b/src/Psalm/Type/Union.php @@ -868,6 +868,13 @@ class Union $valid_input_atomic_types[] = new Type\Atomic\TNamedObject( $input_atomic_type->value ); + } elseif ($input_atomic_type instanceof Type\Atomic\TGenericParamClass) { + $valid_input_atomic_types[] = new Type\Atomic\TGenericParam( + $input_atomic_type->param_name, + $input_atomic_type->as_type + ? new Union([$input_atomic_type->as_type]) + : Type::getMixed() + ); } } diff --git a/tests/Template/TemplateTest.php b/tests/Template/TemplateTest.php index a2a07f9e0..71fb98179 100644 --- a/tests/Template/TemplateTest.php +++ b/tests/Template/TemplateTest.php @@ -1459,6 +1459,26 @@ class TemplateTest extends TestCase '$partB' => 'Collection', ] ], + 'understandTemplatedCalculationInOtherFunction' => [ + '