1
0
mirror of https://github.com/danog/psalm.git synced 2024-12-02 09:37:59 +01:00

bugfix: prevent infinite-loop when resolving type-aliases

The type-expander returns the same `intersection_type` in case something is not properly expandable. To avoid infinite-loop, we do explicitly verify that the expanded  alias is actually resolved

Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com>
This commit is contained in:
Maximilian Bösing 2023-08-27 17:05:13 +02:00
parent 77436b1339
commit d9ebab6b75
No known key found for this signature in database
GPG Key ID: 9A8988C93CEC81A3

View File

@ -1629,9 +1629,7 @@ class TypeParser
continue; continue;
} }
$modified = true; $expanded_intersection_type = TypeExpander::expandAtomic(
$normalized_intersection_types[] = TypeExpander::expandAtomic(
$codebase, $codebase,
$intersection_type, $intersection_type,
null, null,
@ -1644,6 +1642,9 @@ class TypeParser
true, true,
true, true,
); );
$modified = $expanded_intersection_type[0] !== $intersection_type;
$normalized_intersection_types[] = $expanded_intersection_type;
} }
if ($modified === false) { if ($modified === false) {