1
0
mirror of https://github.com/danog/psalm.git synced 2025-01-21 21:31:13 +01:00

Fix #2987 - ignore MixedReturnTypeCoercion for generator send param

This commit is contained in:
Matthew Brown 2020-03-18 21:25:25 -04:00
parent 9e29f6107a
commit f7907eb43f
2 changed files with 8 additions and 2 deletions

View File

@ -2142,6 +2142,13 @@ class TypeAnalyzer
$param_comparison_result,
$allow_interface_equality
)) {
if ($input_type_part->value === 'Generator'
&& $i === 2
&& $param_comparison_result->type_coerced_from_mixed
) {
continue;
}
$atomic_comparison_result->type_coerced
= $param_comparison_result->type_coerced === true
&& $atomic_comparison_result->type_coerced !== false;

View File

@ -643,8 +643,7 @@ class ClassTemplateCovarianceTest extends TestCase
}
/**
* @return Generator<int,Bar,Bar,mixed>
* @psalm-suppress MixedReturnTypeCoercion
* @return Generator<int, Bar, Bar, mixed>
*/
function gen() : Generator {
$bar = yield new Bar();