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
Disallow ... without type in function typehints
[hiphop-php.git]
/
hphp
/
hack
/
test
/
typecheck
/
tuple_union.php
blob
9a6fae1f6aea10b03ca12d3524ec8f7a1f96cda9
1
<
?hh
// strict
2
3
function
id
<
T
>(
T
$x
):
T
{
4
return
$x
;
5
}
6
7
function
apply
<
Ta
,
Tb
>(
Ta
$x
, (
function
(
Ta
):
Tb
)
$f
):
Tb
{
8
return
$f
(
$x
);
9
}
10
11
function
test
(
bool
$x
): (
arraykey
,
int
) {
12
return
apply
(
13
$x
,
14
$x
==> {
15
if
(
$x
) {
16
return
tuple
(
42
,
1
);
17
}
18
return
tuple
(
id
(
'foo'
),
2
);
19
},
20
);
21
}