Disallow ... without type in function typehints
[hiphop-php.git] / hphp / hack / test / typecheck / ternary6.php
blob92f99273178ac69c80b171ab7cbef4d6cb0ea7c3
1 <?hh // partial
3 function takes_string(string $x) {}
5 /* HH_FIXME[4110] */
6 function g(): ?string {
10 class Foo {
11 /* HH_FIXME[4110] */
12 public function h(): array<string> {
17 function f($x, Foo $y) {
18 if (true) {}
19 /* We used to unify both branches of a ternary expression, then falling back
20 * to creating a Tunion if unification failed; this would hide errors
21 * like the one below.
23 $a = $x ? array(g()) : $y->h();
24 takes_string($a[0]);