1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-30 04:39:00 +01:00

Fix #289, make inferred type of yield from expressions mixed

This commit is contained in:
Matthew Brown 2017-11-14 22:29:15 -05:00
parent 23e4c8f68b
commit 2e6b93e4d0
2 changed files with 3 additions and 1 deletions

View File

@ -1961,7 +1961,8 @@ class ExpressionChecker
} }
if (isset($stmt->expr->inferredType)) { if (isset($stmt->expr->inferredType)) {
$stmt->inferredType = $stmt->expr->inferredType; // this should be whatever the generator above returns, but *not* the return type
$stmt->inferredType = Type::getMixed();
} }
return null; return null;

View File

@ -243,6 +243,7 @@ class Php70Test extends TestCase
return 1; return 1;
} }
function foo() : Generator { function foo() : Generator {
/** @var int */
$value = yield from other_generator(); $value = yield from other_generator();
var_export($value); var_export($value);
}', }',