New inference: improved error message for unresolved type
[hiphop-php.git] / hphp / hack / test / typecheck / pipe_ternary.php
blobc723cdcc3c4b554d3e3c8c52656ac76719534ecf
1 <?hh // strict
3 // This test cases checks for a previous bug that
4 // $$ loses its typing information in a ternary
5 // expression. In this bug case the $$ will have Tany,
6 // hence passing both checks. Had it been properly typed,
7 // this will report a type error at expect_string
8 function expect_fail(bool $b): void {
9 $broken = 1 |> ($b ? $$ : $$);
10 expect_int($broken);
11 expect_string($broken);
14 function expect_int(int $i): void {}
15 function expect_string(string $s): void {}