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
No error on use of `unsafe_cast`
[hiphop-php.git]
/
hphp
/
hack
/
test
/
typecheck
/
generic_subtyping.php
blob
f54d8243894b770c19fb28082b6a30a61d0cd100
1
<
?hh
// strict
2
/**
3
* Copyright (c) 2014, Facebook, Inc.
4
* All rights reserved.
5
*
6
* This source code is licensed under the MIT license found in the
7
* LICENSE file in the "hack" directory of this source tree.
8
*
9
*
10
*/
11
12
class
I
{}
13
class
A
extends
I
{}
14
class
B
extends
I
{}
15
16
function
foo
<
T
as
I
>(
T
$x
):
void
{}
17
18
function
test
():
void
{
19
if
(
true
) {
20
$y
=
new
B
();
21
}
22
else
{
23
$y
=
new
A
();
24
}
25
foo
(
$y
);
26
}