New inference: improved error message for unresolved type
[hiphop-php.git] / hphp / hack / test / typecheck / equal1.php
blob4f97eda28b1e902c223ffa4cce3d6ed2b021aa8c
1 <?hh // strict
2 /**
3 * Copyright (c) 2014, Facebook, Inc.
4 * All rights reserved.
6 * This source code is licensed under the MIT license found in the
7 * LICENSE file in the "hack" directory of this source tree.
12 interface I {}
14 class A implements I {}
15 class B implements I {}
17 function createFromMeta(): ?I {
19 $result = null;
20 switch (0) {
21 case 0:
22 $result = new A();
23 break;
24 case 1:
25 $result = new B();
26 break;
27 default:
28 $result = null;
29 break;
32 if ($result === null) {
33 throw new Exception('Cannot create corrector %d.');
35 return $result;