Check for void/noreturn in conditionals
[hiphop-php.git] / hphp / hack / test / typecheck / preparable.php
blobd8ce73204c86669e9266706fdf5512422b7773e4
1 <?hh
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 class Preparable<T> implements Awaitable<T> {
13 public function getWaitHandle(): WaitHandle<T> {
14 // UNSAFE
17 class MyPreparable extends Preparable<MyPreparable> {}
19 async function foo_one(): Awaitable<MyPreparable> {
20 $my_preparable = await (new MyPreparable());
21 return $my_preparable;
24 function foo_two(): Awaitable<array<MyPreparable>> {
25 $my_preparables = yield wait_forv(array(new MyPreparable()));
26 yield result($my_preparables);
29 async function foo_three(): Awaitable<(MyPreparable, MyPreparable)> {
30 $my_preparables = await genva(new MyPreparable(), new MyPreparable());
31 return $my_preparables;