No error on use of `unsafe_cast`
[hiphop-php.git] / hphp / hack / test / typecheck / recursive_non_null_4.php
blobfdc75ef0d0892e0f9d55d20191cb3bb968761ac9
1 <?hh // strict
2 // Copyright 2004-present Facebook. All Rights Reserved.
4 function genData(bool $b): Map<string, mixed> {
5 $data = Map {};
6 hh_show($data);
8 // $data has type Map<var_1,var_2>
10 if ($b) {
11 $data['c'] = null;
12 $data['b'] = 'foo';
13 hh_show($data);
14 // $data has type Map<string,?var_3>
15 // If we UNIFY ?var_3 with mixed then we will get var_3:=mixed
16 return $data;
18 hh_show($data);
20 if ($b) {
21 $data['a'] = 'hey';
23 hh_show($data);
24 return $data;