Allow defaults to call policied
[hiphop-php.git] / hphp / test / slow / rx / body / switch.php
blobf0905a5b04314c06e6f0acdaad3409d312b49fba
1 <?hh
3 function test_switch_with_default(int $x)[rx]: int {
4 switch ($x) {
5 case 0: return 5;
6 case 1: return 6;
7 default: return -1;
11 function test_switch_no_default(int $x)[rx]: int {
12 try {
13 switch ($x) {
14 case 0: return 5;
15 case 1: return 6;
17 } catch (Exception $_) {}
18 return -1;
21 <<__EntryPoint>>
22 function main() {
23 for ($i = 0; $i < 3; $i++) {
24 var_dump(test_switch_with_default($i));
25 var_dump(test_switch_no_default($i));