sync the repo
[hiphop-php.git] / hphp / hack / test / typecheck / ternary7.php
blob425560376503e14aa64cb5c607c85d74eb5a6df1
1 <?hh
3 function takes_int(int $x): void { }
5 function f(): void {
6 $a = 1;
7 if (true) {} // this makes $a into a Tvar mapped to a Tunion[int]
8 /* We used to unify both branches of a ternary expression, then falling back
9 * to creating a Tunion if unification failed; this would create a false
10 * positive error for the code below.
12 true ? null : $a;
13 takes_int($a);