Skip to content

Commit

Permalink
fix reconciliation between a list and iterable
Browse files Browse the repository at this point in the history
  • Loading branch information
orklah committed Jun 22, 2023
1 parent 2e8d575 commit ed5419e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Psalm/Internal/Type/AssertionReconciler.php
Original file line number Diff line number Diff line change
Expand Up @@ -777,6 +777,7 @@ private static function filterAtomicWithAnother(
unset($type_1_param);

$matching_atomic_type = $type_1_atomic->setProperties($type_1_properties);
$matching_atomic_type->fallback_params[1] = $type_2_param;//any fallback type is now the value of iterable

Check failure on line 780 in src/Psalm/Internal/Type/AssertionReconciler.php

View workflow job for this annotation

GitHub Actions / build

InaccessibleProperty

src/Psalm/Internal/Type/AssertionReconciler.php:780:13: InaccessibleProperty: Psalm\Type\Atomic\TKeyedArray::$fallback_params is marked readonly (see https://psalm.dev/054)
$atomic_comparison_results->type_coerced = true;
}

Expand Down
1 change: 1 addition & 0 deletions tests/TypeReconciliation/ReconcilerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ public function providerTestReconcilation(): array
'IsNotAClassReconciliation' => ['int', new Assertion\IsNotAClass(new TNamedObject('IDObject'), true), 'int|IDObject'],
'nonEmptyArray' => ['non-empty-array<array-key, mixed>', new IsType(Atomic::create('non-empty-array')), 'array'],
'nonEmptyList' => ['non-empty-list<mixed>', new IsType(Atomic::create('non-empty-list')), 'array'],
'ListOfInts' => ['list<int>', new IsType(Atomic::create('iterable<int>')), 'list<mixed>'],
];
}

Expand Down

0 comments on commit ed5419e

Please sign in to comment.