No error on use of `unsafe_cast`
[hiphop-php.git] / hphp / hack / test / typecheck / array_foreach.php
blob0340d89ba9c4fe0710439f2e2be2a09469333003
1 <?hh // partial
2 /**
3 * Copyright (c) 2014, Facebook, Inc.
4 * All rights reserved.
6 * This source code is licensed under the MIT license found in the
7 * LICENSE file in the "hack" directory of this source tree.
12 function foo3(varray<string> $arr) {
13 foreach ($arr as $v) {
14 f2($v);
16 $arr[] = 'meh';
17 $arr[10] = 'meh';
18 f2($arr[10]);
19 foo3($arr);
20 foo5($arr);
23 function foo4(varray<string> $arr) {
24 foreach ($arr as $k => $v) {
25 f1($k);
26 f2($v);
30 function foo5(darray<int, string> $arr) {
31 foreach ($arr as $v) {
32 f2($v);
34 $arr[10] = 'meh';
35 f2($arr[10]);
36 foo5($arr);
39 function foo6(darray<int, string> $arr) {
40 foreach ($arr as $k => $v) {
41 f1($k);
42 f2($v);
46 function f1(int $k) {}
48 function f2(string $v) {}