Closed muglug closed 2 years ago
Describe the bug
Type variables leaking from calls to reduce-like functions allows the following bug to go undiscovered:
reduce
function test(vec<int> $trav): void { $arr = HH\Lib\C\reduce($trav, ($acc_v, $element) ==> { $acc_v[] = $element; return $acc_v; }, vec[]); // $arr has type vec<int | [unresolved]> foreach ($arr as $a) { if (!$a is int) { // here $a has type [unresolved] $a->foo(); } } }
Expected behavior
$a can never not be an int, so the call should be flagged
$a
int
Actual behavior
No errors!
Environment
Just realised this bug can never affect runtime execution, so closing.
Describe the bug
Type variables leaking from calls to
reduce
-like functions allows the following bug to go undiscovered:Expected behavior
$a
can never not be anint
, so the call should be flaggedActual behavior
No errors!
Environment