Basic flow analysis on if statements
[hiphop-php.git] / hphp / test / slow / rds-effects.php
blob3dbb1ccd44e772fa4361f5db5a3a583646278916
1 <?hh
3 abstract final class C {
4 static darray<string, mixed> $cache = darray[];
7 <<__NEVER_INLINE>>
8 function getchar($name) {
9 $cached = idx(C::$cache, $name);
10 if ($cached !== null) return $cached;
11 // This line will raise a notice. In the error handler, we may update
12 // C:$cache, so we can't assume that its value remains unchanged here.
13 $new = $name[2];
14 C::$cache[$name] = $new;
15 return $new;
18 <<__EntryPoint>>
19 function main() {
20 set_error_handler((...$args) ==> {
21 for ($i = 0; $i < 17; $i++) {
22 C::$cache[$i] = $i;
24 });
26 print(getchar('test')."\n");
27 print(getchar('no')."\n");