From f482a5cb31db46848bfd2d9ad8b871f9e72bfedc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20B=C3=B6sing?= <2189546+boesing@users.noreply.github.com> Date: Fri, 23 Jun 2023 21:15:37 +0200 Subject: [PATCH] bugfix: pass `non-empty` information when reconciling `iterable` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com> --- src/Psalm/Internal/Type/SimpleAssertionReconciler.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Psalm/Internal/Type/SimpleAssertionReconciler.php b/src/Psalm/Internal/Type/SimpleAssertionReconciler.php index 57dd5c2b1..0602fff82 100644 --- a/src/Psalm/Internal/Type/SimpleAssertionReconciler.php +++ b/src/Psalm/Internal/Type/SimpleAssertionReconciler.php @@ -2441,7 +2441,9 @@ class SimpleAssertionReconciler extends Reconciler $redundant = false; } elseif ($type instanceof TIterable) { - $array_types[] = Type::getListAtomic($type->type_params[1]); + $array_types[] = $is_non_empty + ? Type::getNonEmptyListAtomic($type->type_params[1]) + : Type::getListAtomic($type->type_params[1]); $redundant = false; } else {