New inference: improved error message for unresolved type
[hiphop-php.git] / hphp / hack / test / typecheck / shape_at1.php
blob3927a797e8b51c1053a3def8e611d12e0dd6ef7d
1 <?hh // strict
3 type ClosedShape = shape(
4 'required' => int,
5 ?'optional' => string,
6 'nullable' => ?float,
7 ?'optional_nullable' => ?int,
8 );
10 type OpenShape = shape(...);
12 function test(ClosedShape $closed_shape, OpenShape $open_shape): void {
13 hh_show(Shapes::at($closed_shape, 'required'));
14 hh_show(Shapes::at($closed_shape, 'optional'));
15 hh_show(Shapes::at($closed_shape, 'nullable'));
16 hh_show(Shapes::at($closed_shape, 'optional_nullable'));
17 hh_show(Shapes::at($open_shape, 'unknown'));