Error on self::class on non final classes
[hiphop-php.git] / hphp / hack / test / typecheck / shape_idx3.php
blob92fefa0cb92f3d1e675bd70a06c62691ee0f56b1
1 <?hh // strict
3 type my_shapeA = shape(?'x' => arraykey);
4 type my_shapeB = shape(?'x' => int);
6 function test(
7 my_shapeA $s1,
8 my_shapeB $s2,
9 array<string, arraykey> $a1,
10 array<string, int> $a2,
11 arraykey $a,
12 int $b,
13 ): int {
14 hh_show(idx($a1, 'x', $b));
15 hh_show(idx($a2, 'x', $a));
16 hh_show(Shapes::idx($s1, 'x', $b));
17 hh_show(Shapes::idx($s2, 'x', $a));
19 // Using "wrong" default type will be reported when trying to use the result
20 // in incompatible way
21 return Shapes::idx($s2, 'x', $a);