Skip to content

Commit

Permalink
Combining a array value empty list with a non-empty list was returnin…
Browse files Browse the repository at this point in the history
…g a non-empty-list
  • Loading branch information
robchett committed Oct 26, 2023
1 parent 147505c commit 6044cc7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Psalm/Internal/Type/TypeCombiner.php
Original file line number Diff line number Diff line change
Expand Up @@ -1516,7 +1516,7 @@ private static function getArrayTypeFromGenericParams(
$generic_type_params[1],
$objectlike_generic_type,
$codebase,
$overwrite_empty_array,
false,
$allow_mixed_union,
);
}
Expand Down
9 changes: 9 additions & 0 deletions tests/ArrayAssignmentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2048,6 +2048,15 @@ function getQueryParams(): array
return $queryParams;
}',
],
'AssignListToNonEmptyList' => [
'code' => '<?php
/** @var array<int, non-empty-list<string>> $l*/
$l = [];
$l[] = [];',
'assertions' => [
'$l===' => 'non-empty-array<int, list<string>>',
],
],
];
}

Expand Down

0 comments on commit 6044cc7

Please sign in to comment.