New inference: fix double nullable issue
Summary:
It's possible to produce a "double nullable" that isn't refined by a null test. For example:
```
class Inv<T> {
public function __construct(T $_) {}
public function get(): ?T {
return null;
}
}
function expect_int(int $_): void {}
function test(?int $y): void {
// new Inv<#1>($y) : Inv<#1>
// and ?int <: #1
// After get, we have
// $y : ?#1
// Refinement will just unwrap this nullable, leaving a type variable
$y = (new Inv($y))->get();
if ($y !== null) {
expect_int($y);
}
}
```
The easiest solution is to employ eager solving when expanding a type variable in the `non_null` helper function.
Reviewed By: CatherineGasnier
Differential Revision:
D13669441
fbshipit-source-id:
1a2389cdfe89b1ca0111bf3b658de82cc13be59f