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
/
shape_modified3.php
blob
17091ad732ed036b147e90b5eeb3d2f6fbc9dbb1
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
type my_shape
=
shape
(
13
'x'
=>
int
,
14
'y'
=>
bool
,
15
);
16
17
function
foo
(
bool
$cond
):
my_shape
{
18
$s
=
shape
(
'x'
=>
0
);
19
if
(
$cond
) {
20
$s
[
'y'
] =
0
;
21
}
else
{
22
$s
[
'y'
] =
false
;
23
}
24
return
$s
;
25
}