diff --git a/src/Psalm/Internal/Type/TypeCombiner.php b/src/Psalm/Internal/Type/TypeCombiner.php index 7bad56440..67850a284 100644 --- a/src/Psalm/Internal/Type/TypeCombiner.php +++ b/src/Psalm/Internal/Type/TypeCombiner.php @@ -1516,7 +1516,7 @@ final class TypeCombiner $generic_type_params[1], $objectlike_generic_type, $codebase, - $overwrite_empty_array, + false, $allow_mixed_union, ); } diff --git a/tests/ArrayAssignmentTest.php b/tests/ArrayAssignmentTest.php index 91a319f2f..d7651949d 100644 --- a/tests/ArrayAssignmentTest.php +++ b/tests/ArrayAssignmentTest.php @@ -2048,6 +2048,15 @@ class ArrayAssignmentTest extends TestCase return $queryParams; }', ], + 'AssignListToNonEmptyList' => [ + 'code' => '> $l*/ + $l = []; + $l[] = [];', + 'assertions' => [ + '$l===' => 'non-empty-array>', + ], + ], ]; }