diff --git a/hphp/test/slow/open_tuples/tuple_open_sub.php b/hphp/test/slow/open_tuples/tuple_open_sub.php new file mode 100644 index 0000000000000..da2dc43531f3d --- /dev/null +++ b/hphp/test/slow/open_tuples/tuple_open_sub.php @@ -0,0 +1,46 @@ +> + +function expectAnyTuple((mixed...) $x): void { + var_dump($x); +} +function expectAnyArraykeyTuple((arraykey...) $x): void { + expectAnyTuple($x); + var_dump($x); +} +function expectAtLeastInt((int, mixed...) $x): void { + expectAnyTuple($x); + var_dump($x); +} +function expectIntThenMaybeString((int, optional string) $x): void { + expectAnyTuple($x); + expectAnyArraykeyTuple($x); + var_dump($x); +} +function expectIntThenMaybeArraykeyThenMaybeBool( + (int, optional arraykey, optional bool) $x, +): void { + expectAnyTuple($x); + expectAtLeastInt($x); + var_dump($x); +} + +<<__EntryPoint>> +function test_closed_sub(): void { + $none = tuple(); + $one = tuple(1); + $two = tuple(1, 'a'); + expectAnyTuple($none); + expectAnyTuple($one); + expectAnyTuple($two); + expectAnyArraykeyTuple($none); + expectAnyArraykeyTuple($one); + expectAnyArraykeyTuple($two); + expectAtLeastInt($one); + expectAtLeastInt($two); + expectIntThenMaybeString($one); + expectIntThenMaybeString($two); + expectIntThenMaybeArraykeyThenMaybeBool($one); + expectIntThenMaybeArraykeyThenMaybeBool($two); +} diff --git a/hphp/test/slow/open_tuples/tuple_open_sub.php.expect b/hphp/test/slow/open_tuples/tuple_open_sub.php.expect new file mode 100644 index 0000000000000..6cd6be96c16ab --- /dev/null +++ b/hphp/test/slow/open_tuples/tuple_open_sub.php.expect @@ -0,0 +1,97 @@ +vec(0) { +} +vec(1) { + int(1) +} +vec(2) { + int(1) + string(1) "a" +} +vec(0) { +} +vec(0) { +} +vec(1) { + int(1) +} +vec(1) { + int(1) +} +vec(2) { + int(1) + string(1) "a" +} +vec(2) { + int(1) + string(1) "a" +} +vec(1) { + int(1) +} +vec(1) { + int(1) +} +vec(2) { + int(1) + string(1) "a" +} +vec(2) { + int(1) + string(1) "a" +} +vec(1) { + int(1) +} +vec(1) { + int(1) +} +vec(1) { + int(1) +} +vec(1) { + int(1) +} +vec(2) { + int(1) + string(1) "a" +} +vec(2) { + int(1) + string(1) "a" +} +vec(2) { + int(1) + string(1) "a" +} +vec(2) { + int(1) + string(1) "a" +} +vec(1) { + int(1) +} +vec(1) { + int(1) +} +vec(1) { + int(1) +} +vec(1) { + int(1) +} +vec(2) { + int(1) + string(1) "a" +} +vec(2) { + int(1) + string(1) "a" +} +vec(2) { + int(1) + string(1) "a" +} +vec(2) { + int(1) + string(1) "a" +} diff --git a/hphp/test/slow/open_tuples/tuple_open_sub.php.hphp_opts b/hphp/test/slow/open_tuples/tuple_open_sub.php.hphp_opts new file mode 100644 index 0000000000000..027f3ed6b1330 --- /dev/null +++ b/hphp/test/slow/open_tuples/tuple_open_sub.php.hphp_opts @@ -0,0 +1 @@ +-vRuntime.Hack.Lang.AllowUnstableFeatures=1 diff --git a/hphp/test/slow/open_tuples/tuple_open_sub.php.opts b/hphp/test/slow/open_tuples/tuple_open_sub.php.opts new file mode 100644 index 0000000000000..1f2bf3d662130 --- /dev/null +++ b/hphp/test/slow/open_tuples/tuple_open_sub.php.opts @@ -0,0 +1 @@ +-vHack.Lang.AllowUnstableFeatures=1