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
Untyped variadic function types should not be permitted in strict mode
[hiphop-php.git]
/
hphp
/
hack
/
test
/
typecheck
/
instanceof_newtype.php
blob
f28c0bc77f0f23ff8bd0528f8a1a7274b503468e
1
//// file1.php
2
<
?hh
3
class
Foo
{
4
public
$field
;
5
}
6
7
newtype MyFoo
as
Foo
=
Foo
;
8
9
function
make
(
Foo
$x
):
?MyFoo
{
10
return
$x
->
field
>
0
?
$x
:
null
;
11
}
12
13
//// file2.php
14
<
?hh
// strict
15
16
function
test
(
mixed
$x
,
MyFoo
$y
):
MyFoo
{
17
invariant
(
$x
instanceof
$y
,
''
);
18
hh_show
(
$x
);
19
return
$x
;
20
}