repo.or.cz
/
hiphop-php.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
New inference: improved error message for unresolved type
[hiphop-php.git]
/
hphp
/
hack
/
test
/
typecheck
/
coalesce_bug.php
blob
ac1914fc43f994b11aede65a3892ec9e8c4353ee
1
<
?hh
// strict
2
// Copyright 2004-present Facebook. All Rights Reserved.
3
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
;
10
}
11
12
class
C
{}
13
interface
I
{}
14
function
genI
():
?I
{
15
return null
;
16
}
17
function
genC
(
bool
$f
,
?C
$a
,
?C
$b
,
?I
$c
):
?C
{
18
$r
=
coalesce3
(
$f
?
$a
:
null
,
$b
,
genI
());
19
return
$r
;
20
}