3 * Copyright (c) 2014, Facebook, Inc.
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 function finally_typing1(): string {
17 $a = 'string'; // this definition escapes the clause
22 function finally_typing2(): string {
28 // this definition escapes the clause, even with terminality
34 // with a different story with respect to unreachable code ...
35 // function finally_typing3(): int {
40 // return $a; // terminal block
42 // // this assignment beats out the original, but it doesn't matter
43 // // because the try is fully terminal
49 function do_something(): void
{}
51 function finally_typing3(bool $c): int {
56 throw new Exception();
60 // $a has different types depending on the continuation
63 } catch (Exception
$_) {
64 // $b should be a string here
65 return str_to_int($b);
70 function str_to_int(string $s): int {
74 function finally_typing4(int $x): void
{
79 throw new Exception();
84 throw new Exception();
88 } catch (Exception
$_) {