sync the repo
[hiphop-php.git] / hphp / test / slow / inout / inout-decl.php
blobcf45eeb03d2c9e105ef84bb320db8d0d199d9818
1 <?hh
3 namespace Q {
4 class R {
5 function R(inout $S) :mixed{} // not a constructor because of the namespace
9 namespace {
11 const inout = 12;
13 class Cls {
14 const int inout = 12;
16 function __construct()[] {}
17 function Cls(inout $foo) :mixed{} // not a constructor because of __construct
20 class Herp {
21 function inout(inout $x) :mixed{}
24 class Derp {
25 const int foo = Cls::inout;
28 trait T {
29 function T(inout $x) :mixed{}
32 class C {
33 use T;
36 class PrivGGParent {
37 private function foo(inout $x) :mixed{}
38 private function bar() :mixed{}
41 trait PrivTrait {
42 private function foo($x) :mixed{}
43 private function bar(inout $y) :mixed{}
46 class PrivGParent extends PrivGGParent {
47 use PrivTrait;
50 class PrivParent extends PrivGParent {
51 private function foo(inout $x) :mixed{}
52 private function bar($y) :mixed{}
55 class PrivChild extends PrivParent {
56 private function foo() :mixed{}
57 private function bar(inout $y) :mixed{}
60 function foo($x, $y, inout $z, $q) :mixed{}
61 function bar(inout int $x) :mixed{}
62 function f<T>(inout vec<T> $v, ...$_) :mixed{}
63 function g($q, inout dict<string,vec<int>> $r, ...$_) :mixed{}
64 function h(inout $a, inout $b, $t, inout bool $c, $a = 12) :mixed{}
66 function fptr<T as (function(inout int, inout bool, inout float): arraykey)>(
67 inout $a,
68 (function(inout int, inout Foo, inout float): Bar) $b
69 ): (function(inout float, inout int, float): int) {
72 function main($a, $b, inout $c, $d, $e) :mixed{
73 if ($c === 3) return;
75 foo(1, 2, inout $a, 3);
76 bar(inout $a['x']);
77 f(inout $a['v']['s'], $b['x'], $c);
78 g($a, inout $b, $c);
79 h(inout $a['m'], inout $b, $c, inout $a[$e], $e);
81 $x = Cls::inout;
82 $y = Herp::inout(inout $x);
83 $z = Derp::foo + $x + $y;
85 return $x + $y + $z;
87 <<__EntryPoint>> function main_entry(): void {
88 $a = 3;
89 main(1, 2, inout $a, 4, 5, 6);
90 \var_dump(Cls::inout, Derp::foo);
91 echo "Done.\n";