Push supportdyn into shapes during subtyping
[hiphop-php.git] / hphp / hack / test / sound_dynamic / typing / shape_union.good.php
blob5e494c387ee5b671f5a06e08c9fd90b746e34a6c
1 <?hh
2 // (c) Meta Platforms, Inc. and affiliates. Confidential and proprietary.
4 function expectSD(supportdyn<mixed> $m):void { }
5 function test1(supportdyn<shape(?'a' => int, ...)> $s, supportdyn<shape('b' => bool, ...)> $t, bool $b):void {
6 if ($b) $s = $t;
7 $x = Shapes::idx($s,'a');
8 expectSD($x);
10 function test2(shape(?'a' => int) $s, supportdyn<shape('b' => bool, ...)> $t, bool $b):void {
11 if ($b) $s = $t;
12 $x = Shapes::idx($s,'a');
13 expectSD($x);
15 function test3(shape(?'a' => int) $s, supportdyn<shape('b' => bool, ...)> $t, bool $b):void {
16 if ($b) $t = $s;
17 $x = Shapes::idx($t,'a');
18 expectSD($x);