c2ec1c97c9
A poor man's formatter since I didn't like any of the other ones I found. The original C++ source sometimes put newlines and sometimes not.
Codemods:
codemod '([;{}])([^\n])' '\1\n\2'
codemod -m '\s*<\?php\s+' '<?php\n\n'
codemod '\t' ' '
I hand-fixed all the failing tests
38 linhas
717 B
PHP
38 linhas
717 B
PHP
<?hh
|
|
function vidx<X>(blarg<X> $list, int $idx):X {
|
|
return $list->d[$idx];
|
|
}
|
|
function pair<X,Y>(X $x, Y $y):(X,Y) {
|
|
return array($x, $y);
|
|
}
|
|
function car<X,Y>((X,?Y) $pair):X {
|
|
return $pair[0];
|
|
}
|
|
interface Face<A> {
|
|
}
|
|
class blarg<X> {
|
|
function __construct($x) {
|
|
$this->d = $x;
|
|
}
|
|
}
|
|
function blarg<X>(/*...*/):blarg<X> {
|
|
return new blarg(func_get_args());
|
|
}
|
|
|
|
class Foo<X> implements Face<X> {
|
|
const string BLEH = "b";
|
|
}
|
|
|
|
$blork = pair('c', '-');
|
|
|
|
function right_shift_hack(Foo<Foo<Foo<Foo<Foo<Foo<Foo<Foo<Foo<Foo<Foo>,Foo>>,Foo>>>,Foo>>>> $bonk,
|
|
(function(Foo,Bar):C) $d) {
|
|
}
|
|
|
|
$a = blarg('a','aa','aaa');
|
|
$d = (function():UNICORNS{
|
|
return 'd';
|
|
}
|
|
);
|
|
echo vidx($a, 0), Foo::BLEH, car($blork), $d();
|