New inference: improved error message for unresolved type
[hiphop-php.git] / hphp / hack / test / typecheck / coalesce_bug.php
blobac1914fc43f994b11aede65a3892ec9e8c4353ee
1 <?hh // strict
2 // Copyright 2004-present Facebook. All Rights Reserved.
4 function coalesce3<Tr, Ta as Tr, Tb as Tr, Tc as Tr>(
5 ?Ta $a,
6 ?Tb $b,
7 Tc $c,
8 ): Tr {
9 return $a ?? $b ?? $c;
12 class C {}
13 interface I {}
14 function genI(): ?I {
15 return null;
17 function genC(bool $f, ?C $a, ?C $b, ?I $c): ?C {
18 $r = coalesce3($f ? $a : null, $b, genI());
19 return $r;