No error on use of `unsafe_cast`
[hiphop-php.git] / hphp / hack / test / typecheck / assign_array_unresolved_good.php
blobdaeec18d5647d6d5dd8c9a7cb8d0d3ce0c679b41
1 <?hh // strict
2 // Copyright 2004-present Facebook. All Rights Reserved.
4 function test1(bool $b, vec<int> $x, vec<string> $y, float $z): void {
5 if ($b) {
6 $v = $x;
7 } else {
8 $v = $y;
10 $v[0] = $z;
11 hh_show($v);
14 function test2(bool $b, Vector<num> $x, Vector<arraykey> $y, int $z): void {
15 if ($b) {
16 $v = $x;
17 } else {
18 $v = $y;
20 // $v : Vector<num> | Vector<arraykey> and only values that are subtypes of
21 // both num and arraykey can be appended to $v.
22 $v[0] = $z;