Check for void/noreturn in conditionals
[hiphop-php.git] / hphp / hack / test / typecheck / shapes_cc_4.php
blob523f10d763d630597d49075d157ffa5dc35b07ce
1 <?hh // strict
2 /**
3 * Copyright (c) 2014, Facebook, Inc.
4 * All rights reserved.
6 * This source code is licensed under the BSD-style license found in the
7 * LICENSE file in the "hack" directory of this source tree. An additional grant
8 * of patent rights can be found in the PATENTS file in the same directory.
12 // This should fail for using a nonexistent class constant.
14 class X {
15 const string X1 = 'field1';
16 const string X2 = 'field2';
19 type myshape = shape(
20 X::X1 => int,
21 X::X2 => bool,
24 function test(): myshape {
25 $x = shape(X::X1 => 1, X::X2 => true, X::X3 => false);
26 $y = shape(X::X1 => 1, X::X2 => true);
27 return $y;
30 function test2(): void {
31 $y = test();
32 $z = $y[X::X1];