language
stringlengths
0
24
filename
stringlengths
9
214
code
stringlengths
99
9.93M
Hack
hhvm/hphp/hack/test/extracted_from_manual/20-attributes/07-predefined-attributes-01.hack
// @generated by hh_manual from manual/hack/20-attributes/07-predefined-attributes.md // @codegen-command : buck run fbcode//hphp/hack/src/hh_manual:hh_manual extract fbcode/hphp/hack/manual/hack/ <<__ConsistentConstruct>> class Base { public function __construct() {} public static function make(): this { return new static(); } } class Derived extends Base { public function __construct() { parent::__construct(); } } function demo(): void { $v2 = Derived::make(); }
Hack
hhvm/hphp/hack/test/extracted_from_manual/20-attributes/07-predefined-attributes-02.hack
// @generated by hh_manual from manual/hack/20-attributes/07-predefined-attributes.md // @codegen-command : buck run fbcode//hphp/hack/src/hh_manual:hh_manual extract fbcode/hphp/hack/manual/hack/ <<__Deprecated("This function has been replaced by do_that", 7)>> function do_this(): void { /* ... */ }
hhvm/hphp/hack/test/extracted_from_manual/20-attributes/07-predefined-attributes-03.hack_error
// @generated by hh_manual from manual/hack/20-attributes/07-predefined-attributes.md // @codegen-command : buck run fbcode//hphp/hack/src/hh_manual:hh_manual extract fbcode/hphp/hack/manual/hack/ abstract class A { abstract const type Tnoenf; <<__Enforceable>> abstract const type Tenf; public function f(mixed $m): void { $m as this::Tenf; // OK $m as this::Tnoenf; // Hack error } } class B1 extends A { const type Tnoenf = (function (): void); // ok const type Tenf = (function (): void); // Hack error, function types cannot be used in type tests } class B2 extends A { const type Tnoenf = (function (): void); // ok const type Tenf = int; // ok }
hhvm/hphp/hack/test/extracted_from_manual/20-attributes/07-predefined-attributes-04.hack_error
// @generated by hh_manual from manual/hack/20-attributes/07-predefined-attributes.md // @codegen-command : buck run fbcode//hphp/hack/src/hh_manual:hh_manual extract fbcode/hphp/hack/manual/hack/ function values_are_equal<<<__Explicit>> T>(T $x, T $y): bool { return $x === $y; } function example_usage(int $x, int $y, string $s): void { values_are_equal<int>($x, $y); // Without <<__Explicit>>, this code would be fine, even though // it always returns false. values_are_equal($x, $s); }
Hack
hhvm/hphp/hack/test/extracted_from_manual/20-attributes/07-predefined-attributes-05.hack
// @generated by hh_manual from manual/hack/20-attributes/07-predefined-attributes.md // @codegen-command : buck run fbcode//hphp/hack/src/hh_manual:hh_manual extract fbcode/hphp/hack/manual/hack/ <<__EntryPoint>> function main(): void { printf("Hello, World!\n"); }
Hack
hhvm/hphp/hack/test/extracted_from_manual/20-attributes/07-predefined-attributes-06.hack
// @generated by hh_manual from manual/hack/20-attributes/07-predefined-attributes.md // @codegen-command : buck run fbcode//hphp/hack/src/hh_manual:hh_manual extract fbcode/hphp/hack/manual/hack/ class Foo {} class Bar { <<__LateInit>> private Foo $f; public function trustMeThisIsCalledEarly(): void { $this->f = new Foo(); } }
Hack
hhvm/hphp/hack/test/extracted_from_manual/20-attributes/07-predefined-attributes-07.hack
// @generated by hh_manual from manual/hack/20-attributes/07-predefined-attributes.md // @codegen-command : buck run fbcode//hphp/hack/src/hh_manual:hh_manual extract fbcode/hphp/hack/manual/hack/ class Foo {} class Bar { <<__LateInit>> private static Foo $f; public static function trustMeThisIsCalledEarly(): void { self::$f = new Foo(); } }
Hack
hhvm/hphp/hack/test/extracted_from_manual/20-attributes/07-predefined-attributes-08.hack
// @generated by hh_manual from manual/hack/20-attributes/07-predefined-attributes.md // @codegen-command : buck run fbcode//hphp/hack/src/hh_manual:hh_manual extract fbcode/hphp/hack/manual/hack/ class CountThrows { private int $count = -1; <<__Memoize>> public function doStuff(): void { $this->count += 1; throw new \Exception('Hello '.$this->count); } } <<__EntryPoint>> function main(): void { $x = new CountThrows(); for($i = 0; $i < 2; ++$i) { try { $x->doStuff(); } catch (\Exception $e) { \var_dump($e->getMessage()); } } }
Hack
hhvm/hphp/hack/test/extracted_from_manual/20-attributes/07-predefined-attributes-09.hack
// @generated by hh_manual from manual/hack/20-attributes/07-predefined-attributes.md // @codegen-command : buck run fbcode//hphp/hack/src/hh_manual:hh_manual extract fbcode/hphp/hack/manual/hack/ final class A {} function f<<<__Newable>> reify T as A>(): T { return new T(); }
Hack
hhvm/hphp/hack/test/extracted_from_manual/20-attributes/07-predefined-attributes-10.hack
// @generated by hh_manual from manual/hack/20-attributes/07-predefined-attributes.md // @codegen-command : buck run fbcode//hphp/hack/src/hh_manual:hh_manual extract fbcode/hphp/hack/manual/hack/ <<__ConsistentConstruct>> abstract class A { public function __construct(int $x, int $y) {} } class B extends A {} function f<<<__Newable>> reify T as A>(int $x, int $y): T { return new T($x,$y); } <<__EntryPoint>> function main(): void { f<B>(3,4); // success, equivalent to new B(3,4) }
Hack
hhvm/hphp/hack/test/extracted_from_manual/20-attributes/07-predefined-attributes-11.hack
// @generated by hh_manual from manual/hack/20-attributes/07-predefined-attributes.md // @codegen-command : buck run fbcode//hphp/hack/src/hh_manual:hh_manual extract fbcode/hphp/hack/manual/hack/ class Button { // If we rename 'draw' to 'render' in the parent class, public function draw(): void { /* ... */ } } class CustomButton extends Button { // then the child class would get a type error. <<__Override>> public function draw(): void { /* ... */ } }
Hack
hhvm/hphp/hack/test/extracted_from_manual/20-attributes/07-predefined-attributes-12.hack
// @generated by hh_manual from manual/hack/20-attributes/07-predefined-attributes.md // @codegen-command : buck run fbcode//hphp/hack/src/hh_manual:hh_manual extract fbcode/hphp/hack/manual/hack/ class Button { public function draw(): void { /* ... */ } } trait MyButtonTrait { <<__Override>> public function draw(): void { /* ... */ } } class ExampleButton extends Button { // If ExampleButton did not have an inherited method // called 'draw', this would be an error. use MyButtonTrait; }
Hack
hhvm/hphp/hack/test/extracted_from_manual/20-attributes/07-predefined-attributes-13.hack
// @generated by hh_manual from manual/hack/20-attributes/07-predefined-attributes.md // @codegen-command : buck run fbcode//hphp/hack/src/hh_manual:hh_manual extract fbcode/hphp/hack/manual/hack/ class Button { public function draw(): void { /* ... */ } } trait MyButtonTrait { // This makes the relationship with Button explicit. require extends Button; public function draw(): void { /* ... */ } } class ExampleButton extends Button { use MyButtonTrait; }
Hack
hhvm/hphp/hack/test/extracted_from_manual/20-attributes/07-predefined-attributes-14.hack
// @generated by hh_manual from manual/hack/20-attributes/07-predefined-attributes.md // @codegen-command : buck run fbcode//hphp/hack/src/hh_manual:hh_manual extract fbcode/hphp/hack/manual/hack/ <<__Sealed(X::class, Y::class)>> abstract class A {} class X extends A {} class Y extends A {} <<__Sealed(Z::class)>> interface I {} class Z implements I {}
Hack
hhvm/hphp/hack/test/extracted_from_manual/20-attributes/07-predefined-attributes-base.hack
// @generated by hh_manual from manual/hack/20-attributes/07-predefined-attributes.md // @codegen-command : buck run fbcode//hphp/hack/src/hh_manual:hh_manual extract fbcode/hphp/hack/manual/hack/ <<__Docs("http://www.example.com/my_framework")>> class MyFrameworkBaseClass {} class MyClass extends MyFrameworkBaseClass {}
Hack
hhvm/hphp/hack/test/extracted_from_manual/30-silencing-errors/01-introduction-takes_int.hack
// @generated by hh_manual from manual/hack/30-silencing-errors/01-introduction.md // @codegen-command : buck run fbcode//hphp/hack/src/hh_manual:hh_manual extract fbcode/hphp/hack/manual/hack/ function takes_int(int $i): int { return $i + 1; } function takes_float_with_fixme(float $i): float { /* HH_FIXME[4110] calls takes_int with wrong param type AND returns wrong type */ return takes_int($i); } function takes_float_with_unsafe_cast(float $i): float { return HH\FIXME\UNSAFE_CAST<int, float>( takes_int(HH\FIXME\UNSAFE_CAST<float, int>($i, 'wrong param type')), 'returns wrong type', ); } async function example_snippet_wrapper1(): Awaitable<void> { /* HH_FIXME[4110] Your explanation here. */ takes_int("foo"); } async function example_snippet_wrapper2(): Awaitable<void> { /* HH_FIXME[4110] An example fixme. */ takes_int("foo"); /* HH_IGNORE_ERROR[4110] This is equivalent to the HH_FIXME above. */ takes_int("foo"); }
Hack
hhvm/hphp/hack/test/extracted_from_manual/30-silencing-errors/05-error-codes-01.hack
// @generated by hh_manual from manual/hack/30-silencing-errors/05-error-codes.md // @codegen-command : buck run fbcode//hphp/hack/src/hh_manual:hh_manual extract fbcode/hphp/hack/manual/hack/ function foo(): void { /* HH_FIXME[4107] No such function (type checking). */ /* HH_FIXME[2049] No such function (global name check). */ nonexistent_function(); }
Hack
hhvm/hphp/hack/test/extracted_from_manual/30-silencing-errors/05-error-codes-02.hack
// @generated by hh_manual from manual/hack/30-silencing-errors/05-error-codes.md // @codegen-command : buck run fbcode//hphp/hack/src/hh_manual:hh_manual extract fbcode/hphp/hack/manual/hack/ function foo(): mixed { /* HH_FIXME[2050] This variable doesn't exist. */ return $no_such_var; }
Hack
hhvm/hphp/hack/test/extracted_from_manual/30-silencing-errors/05-error-codes-03.hack
// @generated by hh_manual from manual/hack/30-silencing-errors/05-error-codes.md // @codegen-command : buck run fbcode//hphp/hack/src/hh_manual:hh_manual extract fbcode/hphp/hack/manual/hack/ function foo(mixed $m): void { /* HH_FIXME[4006] $m may not be an array. */ $m[] = 1; }
Hack
hhvm/hphp/hack/test/extracted_from_manual/30-silencing-errors/05-error-codes-04.hack
// @generated by hh_manual from manual/hack/30-silencing-errors/05-error-codes.md // @codegen-command : buck run fbcode//hphp/hack/src/hh_manual:hh_manual extract fbcode/hphp/hack/manual/hack/ /* HH_FIXME[4030] Missing a return type declaration. */ function foo() { return 1; }
Hack
hhvm/hphp/hack/test/extracted_from_manual/30-silencing-errors/05-error-codes-05.hack
// @generated by hh_manual from manual/hack/30-silencing-errors/05-error-codes.md // @codegen-command : buck run fbcode//hphp/hack/src/hh_manual:hh_manual extract fbcode/hphp/hack/manual/hack/ function foo(shape(...) $s): void { /* HH_FIXME[4051] Invalid shape field name. */ $value = $s[1.0]; }
Hack
hhvm/hphp/hack/test/extracted_from_manual/30-silencing-errors/05-error-codes-06.hack
// @generated by hh_manual from manual/hack/30-silencing-errors/05-error-codes.md // @codegen-command : buck run fbcode//hphp/hack/src/hh_manual:hh_manual extract fbcode/hphp/hack/manual/hack/ class MyClass {} function takes_myclass(MyClass $c): void { /* HH_FIXME[4053] No such method. */ $c->someMethod(); /* HH_FIXME[4053] No such property. */ $x = $c->someProperty; }
Hack
hhvm/hphp/hack/test/extracted_from_manual/30-silencing-errors/05-error-codes-07.hack
// @generated by hh_manual from manual/hack/30-silencing-errors/05-error-codes.md // @codegen-command : buck run fbcode//hphp/hack/src/hh_manual:hh_manual extract fbcode/hphp/hack/manual/hack/ function foo(): shape('x' => int) { /* HH_FIXME[4057] Missing the field `x`. */ return shape(); }
Hack
hhvm/hphp/hack/test/extracted_from_manual/30-silencing-errors/05-error-codes-08.hack
// @generated by hh_manual from manual/hack/30-silencing-errors/05-error-codes.md // @codegen-command : buck run fbcode//hphp/hack/src/hh_manual:hh_manual extract fbcode/hphp/hack/manual/hack/ function foo(?vec<int> $items): void { /* HH_FIXME[4063] $items can be null. */ $x = $items[0]; }
Hack
hhvm/hphp/hack/test/extracted_from_manual/30-silencing-errors/05-error-codes-09.hack
// @generated by hh_manual from manual/hack/30-silencing-errors/05-error-codes.md // @codegen-command : buck run fbcode//hphp/hack/src/hh_manual:hh_manual extract fbcode/hphp/hack/manual/hack/ class MyClass { public int $x = 0; public function foo(): void {} } function foo(?MyClass $m): void { /* HH_FIXME[4064] Accessing a property on a nullable object. */ $value = $m->x; /* HH_FIXME[4064] Calling a method on a nullable object. */ $m->foo(); }
Hack
hhvm/hphp/hack/test/extracted_from_manual/30-silencing-errors/05-error-codes-10.hack
// @generated by hh_manual from manual/hack/30-silencing-errors/05-error-codes.md // @codegen-command : buck run fbcode//hphp/hack/src/hh_manual:hh_manual extract fbcode/hphp/hack/manual/hack/ class MyBox<T> { public ?T $x = null; } /* HH_FIXME[4101] Missing a type parameter. */ class TooFewArguments extends MyBox {} /* HH_FIXME[4101] Too many type parameters. */ class TooManyArguments extends MyBox<mixed, mixed> {}
Hack
hhvm/hphp/hack/test/extracted_from_manual/30-silencing-errors/05-error-codes-11.hack
// @generated by hh_manual from manual/hack/30-silencing-errors/05-error-codes.md // @codegen-command : buck run fbcode//hphp/hack/src/hh_manual:hh_manual extract fbcode/hphp/hack/manual/hack/ function foo(): void { /* HH_FIXME[4107] No such function (type checking). */ /* HH_FIXME[2049] No such function (global name check). */ nonexistent_function(); }
Hack
hhvm/hphp/hack/test/extracted_from_manual/30-silencing-errors/05-error-codes-12.hack
// @generated by hh_manual from manual/hack/30-silencing-errors/05-error-codes.md // @codegen-command : buck run fbcode//hphp/hack/src/hh_manual:hh_manual extract fbcode/hphp/hack/manual/hack/ function foo(shape('x' => int) $s): void { /* HH_FIXME[4108] No such field in this shape. */ $value = $s['not_x']; }
Hack
hhvm/hphp/hack/test/extracted_from_manual/30-silencing-errors/05-error-codes-13.hack
// @generated by hh_manual from manual/hack/30-silencing-errors/05-error-codes.md // @codegen-command : buck run fbcode//hphp/hack/src/hh_manual:hh_manual extract fbcode/hphp/hack/manual/hack/ function takes_int(int $_): void {} function foo(): void { /* HH_FIXME[4110] Passing incorrect type to a function. */ takes_int("hello"); /* HH_FIXME[4110] Addition on a value that isn't a num. */ "1" + 3; }
Hack
hhvm/hphp/hack/test/extracted_from_manual/30-silencing-errors/05-error-codes-14.hack
// @generated by hh_manual from manual/hack/30-silencing-errors/05-error-codes.md // @codegen-command : buck run fbcode//hphp/hack/src/hh_manual:hh_manual extract fbcode/hphp/hack/manual/hack/ function foo_new(): void {} <<__Deprecated("Use foo_new instead")>> function foo_old(): void {} function bar(): void { /* HH_FIXME[4128] Calling a deprecated function. */ foo_old(); }
Hack
hhvm/hphp/hack/test/extracted_from_manual/30-silencing-errors/05-error-codes-15.hack
// @generated by hh_manual from manual/hack/30-silencing-errors/05-error-codes.md // @codegen-command : buck run fbcode//hphp/hack/src/hh_manual:hh_manual extract fbcode/hphp/hack/manual/hack/ function foo(shape(?'x' => int) $s): void { /* HH_FIXME[4165] This field may not be present. */ $value = $s['x']; }
Hack
hhvm/hphp/hack/test/extracted_from_manual/30-silencing-errors/05-error-codes-16.hack
// @generated by hh_manual from manual/hack/30-silencing-errors/05-error-codes.md // @codegen-command : buck run fbcode//hphp/hack/src/hh_manual:hh_manual extract fbcode/hphp/hack/manual/hack/ class MyA { public function doStuff(): void {} } function foo(): void { /* HH_FIXME[4297] Cannot infer the type of $x. */ $f = $x ==> $x->doStuff(); $f(new MyA()); }
Hack
hhvm/hphp/hack/test/extracted_from_manual/30-silencing-errors/05-error-codes-17.hack
// @generated by hh_manual from manual/hack/30-silencing-errors/05-error-codes.md // @codegen-command : buck run fbcode//hphp/hack/src/hh_manual:hh_manual extract fbcode/hphp/hack/manual/hack/ /* HH_FIXME[4323] A dict must have arraykey, int or string keys. */ function foo(dict<mixed, bool> $d): void {}
Hack
hhvm/hphp/hack/test/extracted_from_manual/30-silencing-errors/05-error-codes-18.hack
// @generated by hh_manual from manual/hack/30-silencing-errors/05-error-codes.md // @codegen-command : buck run fbcode//hphp/hack/src/hh_manual:hh_manual extract fbcode/hphp/hack/manual/hack/ function foo(int $m): void { /* HH_FIXME[4324] Indexing a type that isn't indexable. */ $value = $m['foo']; }
hhvm/hphp/hack/test/extracted_from_manual/55-expression-trees/05-syntax-supported-01.hack_error
// @generated by hh_manual from manual/hack/55-expression-trees/05-syntax-supported.md // @codegen-command : buck run fbcode//hphp/hack/src/hh_manual:hh_manual extract fbcode/hphp/hack/manual/hack/ async function example_snippet_wrapper(): Awaitable<void> { MyDsl`1`; // OK: 1 is an expression MyDsl`while(true) {}`; // Bad: statement MyDsl`() ==> { while true() {} }`; // OK: statements are allowed in lambdas MyDsl`class Foo {}`; // Bad: top-level declaration. }
Hack
hhvm/hphp/hack/test/extracted_from_manual/55-expression-trees/05-syntax-supported-02.hack
// @generated by hh_manual from manual/hack/55-expression-trees/05-syntax-supported.md // @codegen-command : buck run fbcode//hphp/hack/src/hh_manual:hh_manual extract fbcode/hphp/hack/manual/hack/ <<file:__EnableUnstableFeatures('expression_trees')>> function example1(): void { $num = ExampleDsl`1 + 1`; ExampleDsl`() ==> { $n = ${$num}; return $n + $n; }()`; }
Hack
hhvm/hphp/hack/test/extracted_from_manual/55-expression-trees/05-syntax-supported-03.hack
// @generated by hh_manual from manual/hack/55-expression-trees/05-syntax-supported.md // @codegen-command : buck run fbcode//hphp/hack/src/hh_manual:hh_manual extract fbcode/hphp/hack/manual/hack/ <<file:__EnableUnstableFeatures('expression_trees')>> function example2(): void { $num = ExampleDsl`1 + 1`; ExampleDsl`{ $n = ${$num}; return $n + $n; }`; }
Hack
hhvm/hphp/hack/test/extracted_from_manual/55-expression-trees/10-splicing-01.hack
// @generated by hh_manual from manual/hack/55-expression-trees/10-splicing.md // @codegen-command : buck run fbcode//hphp/hack/src/hh_manual:hh_manual extract fbcode/hphp/hack/manual/hack/ <<file:__EnableUnstableFeatures('expression_trees')>> function splicing_example(bool $b): ExprTree<ExampleDsl, mixed, ExampleString> { $name = $b ? ExampleDsl`"world"` : ExampleDsl`"universe"`; return ExampleDsl`"Hello, ".${$name}."!"`; }
Hack
hhvm/hphp/hack/test/extracted_from_manual/55-expression-trees/10-splicing-02.hack
// @generated by hh_manual from manual/hack/55-expression-trees/10-splicing.md // @codegen-command : buck run fbcode//hphp/hack/src/hh_manual:hh_manual extract fbcode/hphp/hack/manual/hack/ <<file:__EnableUnstableFeatures('expression_trees')>> function splicing_example2(bool $b): ExprTree<ExampleDsl, mixed, ExampleString> { return $b ? ExampleDsl`"Hello, "."world"."!"` : ExampleDsl`"Hello, "."universe"."!"`; }
hhvm/hphp/hack/test/extracted_from_manual/55-expression-trees/10-splicing-03.hack_error
// @generated by hh_manual from manual/hack/55-expression-trees/10-splicing.md // @codegen-command : buck run fbcode//hphp/hack/src/hh_manual:hh_manual extract fbcode/hphp/hack/manual/hack/ async function example_snippet_wrapper(): Awaitable<void> { $var = ExampleDsl`$x`; // type error: $x is not defined ExampleDsl`($x) ==> { return ${$var}; }`; }
Hack
hhvm/hphp/hack/test/extracted_from_manual/55-expression-trees/15-defining-dsls-mydsl.hack
// @generated by hh_manual from manual/hack/55-expression-trees/15-defining-dsls.md // @codegen-command : buck run fbcode//hphp/hack/src/hh_manual:hh_manual extract fbcode/hphp/hack/manual/hack/ abstract class MyDslAst {} class MyDslAstBinOp extends MyDslAst { public function __construct( public MyDslAst $lhs, public string $operator, public MyDslAst $rhs, ) {} } class MyDslAstInt extends MyDslAst { public function __construct(public int $value) {} } class MyDsl { public static function makeTree<<<__Explicit>> TInfer>( ?ExprPos $pos, mixed $_metadata, (function(MyDsl): MyDslAst) $visit_expr, ): MyDslExprTree<TInfer> { return new MyDslExprTree($pos, $visit_expr); } // ... all the visitFoo methods here } class MyDslExprTree<+T> implements Spliceable<MyDsl, MyDslAst, T> { public function __construct( public ?ExprPos $pos, private (function(MyDsl): MyDslAst) $builder, ) {} public function visit(MyDsl $v): MyDslAst { return ($this->builder)($v); } }
Hack
hhvm/hphp/hack/test/extracted_from_manual/55-expression-trees/20-dsl-types-types.hack
// @generated by hh_manual from manual/hack/55-expression-trees/20-dsl-types.md // @codegen-command : buck run fbcode//hphp/hack/src/hh_manual:hh_manual extract fbcode/hphp/hack/manual/hack/ class MyDsl { // Types for literals public static function intType(): MyDslInt { throw new Exception(); } public static function floatType(): MyDslFloat { throw new Exception(); } public static function boolType(): MyDslBool { throw new Exception(); } public static function stringType(): MyDslString { throw new Exception(); } // Visitors can use the normal Hack types if they wish. // This is particularly common for null and void. public static function nullType(): null { throw new Exception(); } public static function voidType(): void { throw new Exception(); } // symbolType is used in function calls. // In this example, MyDsl is using normal Hack // functions but DSLs may choose more specific APIs. public static function symbolType<T>( T $_, ): T { throw new Exception(); } } interface MyDslNonnull { public function __tripleEquals(?MyDslNonnull $_): MyDslBool; public function __notTripleEquals(?MyDslNonnull $_): MyDslBool; } interface MyDslNum extends MyDslNonnull { // Arithmetic public function __plus(MyDslNum $_): MyDslNum; public function __minus(MyDslNum $_): MyDslNum; public function __star(MyDslNum $_): MyDslNum; public function __slash(MyDslNum $_): MyDslNum; public function __negate(): MyDslNum; // Comparisons public function __lessThan(MyDslNum $_): MyDslBool; public function __lessThanEqual(MyDslNum $_): MyDslBool; public function __greaterThan(MyDslNum $_): MyDslBool; public function __greaterThanEqual(MyDslNum $_): MyDslBool; } interface MyDslInt extends MyDslNum { // Only support modulus on integers in our demo. public function __percent(MyDslInt $_): MyDslInt; // Bitwise operators public function __amp(MyDslInt $_): MyDslInt; public function __bar(MyDslInt $_): MyDslInt; public function __caret(MyDslInt $_): MyDslInt; public function __lessThanLessThan(MyDslInt $_): MyDslInt; public function __greaterThanGreaterThan(MyDslInt $_): MyDslInt; public function __tilde(): MyDslInt; } interface MyDslFloat extends MyDslNum { <<__Override>> public function __plus(MyDslNum $_): MyDslFloat; } interface MyDslString extends MyDslNonnull { public function __dot(MyDslString $_): MyDslString; } interface MyDslBool extends MyDslNonnull { // __bool signifies that we can use MyDslBool in positions that require // a truthy value, such as if statements. public function __bool(): bool; // Infix operators that return another MyDslBool. public function __ampamp(MyDslBool $_): MyDslBool; public function __barbar(MyDslBool $_): MyDslBool; public function __exclamationMark(): MyDslBool; }
Hack
hhvm/hphp/hack/test/extracted_from_manual/56-memoization-options/01-introduction-01.hack
// @generated by hh_manual from manual/hack/56-memoization-options/01-introduction.md // @codegen-command : buck run fbcode//hphp/hack/src/hh_manual:hh_manual extract fbcode/hphp/hack/manual/hack/ <<__Memoize(#MakeICInaccessible)>> function get_same_random_int(): int { return HH\Lib\PseudoRandom\int(); }
PHP
hhvm/hphp/hack/test/fanout/add_method_hierarchy.php
//// base-a.php <?hh class A { public function foo(string $c): void {} } //// base-b.php <?hh class B extends A {} //// base-c.php <?hh class C extends B {} //// base-d.php <?hh class D extends C { public function foo(string $c): void {} } //// base-use.php <?hh function f(): void { $c->foo(""); } //// changed-a.php <?hh class A { public function foo(string $c): void {} } //// changed-b.php <?hh class B extends A { public function foo(int $c): void {} } //// changed-c.php <?hh class C extends B {} //// changed-d.php <?hh class D extends C { public function foo(string $c): void {} } //// changed-use.php <?hh function f(): void { $c->foo(""); }
PHP
hhvm/hphp/hack/test/fanout/add_prop_hierarchy.php
//// base-a.php <?hh class A { public int $foo = 0; } //// base-b.php <?hh class B extends A {} //// base-c.php <?hh class C extends B {} //// base-d.php <?hh class D extends C { public int $foo = 0; } //// base-use.php <?hh function f(): void { $c->foo = 0; } //// changed-a.php <?hh class A { public int $foo = 0; } //// changed-b.php <?hh class B extends A { public string $foo = 0; } //// changed-c.php <?hh class C extends B {} //// changed-d.php <?hh class D extends C { public int $foo = 0; } //// changed-use.php <?hh function f(): void { $c->foo = 0; }
PHP
hhvm/hphp/hack/test/fanout/add_remove_classes.php
//// base-a.php <?hh //// base-b.php <?hh class B {} //// base-f.php <?hh function f(): void { new A(); } //// base-g.php <?hh function g(): void { new B(); } //// changed-a.php <?hh class A {} //// changed-b.php <?hh //// changed-f.php <?hh function f(): void { new A(); } //// changed-g.php <?hh function g(): void { new B(); }
PHP
hhvm/hphp/hack/test/fanout/add_static_method_hierarchy.php
//// base-a.php <?hh class A { public static function foo(string $c): void {} } //// base-b.php <?hh class B extends A {} //// base-c.php <?hh class C extends B {} //// base-d.php <?hh class D extends C { public static function foo(string $c): void {} } //// base-use.php <?hh function f(): void { C::foo(""); } //// changed-a.php <?hh class A { public static function foo(string $c): void {} } //// changed-b.php <?hh class B extends A { public static function foo(int $c): void {} } //// changed-c.php <?hh class C extends B {} //// changed-d.php <?hh class D extends C { public static function foo(string $c): void {} } //// changed-use.php <?hh function f(): void { C::foo(""); }
PHP
hhvm/hphp/hack/test/fanout/class_add_ancestor.php
//// base-a.php <?hh class A {} //// base-b.php <?hh class B { public function foo(): void {} } //// base-use-b.php <?hh function use_b_foo(): void { (new B())->foo(); } //// changed-a.php <?hh class A {} //// changed-b.php <?hh class B extends A { public function foo(): void {} } //// changed-use-b.php <?hh function use_b_foo(): void { (new B())->foo(); }
PHP
hhvm/hphp/hack/test/fanout/class_change_method_type_empty_children.php
//// base-a.php <?hh class A { public function foo(): arraykey { return "s"; } } //// base-b.php <?hh class B extends A {} //// base-c.php <?hh class C extends B {} //// base-use-foo.php <?hh function accept_arraykey(arraykey $_): void {} function use_a_foo(): void { accept_arraykey((new A())->foo()); } function use_b_foo(): void { accept_arraykey((new B())->foo()); } function use_c_foo(): void { accept_arraykey((new C())->foo()); } //// changed-a.php <?hh class A { public function foo(): string { return "s"; } } //// changed-b.php <?hh class B extends A {} //// changed-c.php <?hh class C extends B {} //// changed-use-foo.php <?hh function accept_arraykey(arraykey $_): void {} function use_a_foo(): void { accept_arraykey((new A())->foo()); } function use_b_foo(): void { accept_arraykey((new B())->foo()); } function use_c_foo(): void { accept_arraykey((new C())->foo()); }
PHP
hhvm/hphp/hack/test/fanout/class_change_method_type_overriding_children.php
//// base-a.php <?hh class A { public function foo(): arraykey { return "s"; } } //// base-b.php <?hh class B extends A { public function foo(): int { return 5; } } //// base-c.php <?hh class C extends B { public function foo(): int { return 6; } } //// base-use-foo.php <?hh function accept_arraykey(arraykey $_): void {} function use_a_foo(): void { accept_arraykey((new A())->foo()); } function use_b_foo(): void { accept_arraykey((new B())->foo()); } function use_c_foo(): void { accept_arraykey((new C())->foo()); } //// changed-a.php <?hh class A { public function foo(): string { return "s"; } } //// changed-b.php <?hh class B extends A { public function foo(): int { return 5; } } //// changed-c.php <?hh class C extends B { public function foo(): int { return 6; } } //// changed-use-foo.php <?hh function accept_arraykey(arraykey $_): void {} function use_a_foo(): void { accept_arraykey((new A())->foo()); } function use_b_foo(): void { accept_arraykey((new B())->foo()); } function use_c_foo(): void { accept_arraykey((new C())->foo()); }
PHP
hhvm/hphp/hack/test/fanout/class_class_const_change_origin.php
//// base-a.php <?hh class A { const int C = 3; } //// base-b.php <?hh class B extends A { const int C = 4; } //// base-c.php <?hh class C extends B {} //// base-use.php <?hh function take_int(int $_): void {} function use_a_const(): void { take_int(A::C); } function use_b_const(): void { take_int(B::C); } function use_c_const(): void { take_int(C::C); } //// changed-a.php <?hh class A { const int C = 3; } //// changed-b.php <?hh class B extends A { // Removing B::C will change the origin field of C::C and thus // trigger a type check of places that use C::C! Weird! } //// changed-c.php <?hh class C extends B {} //// changed-use.php <?hh function take_int(int $_): void {} function use_a_const(): void { take_int(A::C); } function use_b_const(): void { take_int(B::C); } function use_c_const(): void { take_int(C::C); }
PHP
hhvm/hphp/hack/test/fanout/class_class_const_change_type.php
//// base-a.php <?hh class A { const int C = 3; } //// base-b.php <?hh class B extends A { const int C = 4; } //// base-c.php <?hh class C extends B {} //// base-use.php <?hh function take_int(int $_): void {} function use_a_const(): void { take_int(A::C); } function use_b_const(): void { take_int(B::C); } function use_c_const(): void { take_int(C::C); } //// changed-a.php <?hh class A { const bool C = false; } //// changed-b.php <?hh class B extends A { const int C = 4; } //// changed-c.php <?hh class C extends B {} //// changed-use.php <?hh function take_int(int $_): void {} function use_a_const(): void { take_int(A::C); } function use_b_const(): void { take_int(B::C); } function use_c_const(): void { take_int(C::C); }
PHP
hhvm/hphp/hack/test/fanout/class_class_const_change_type2.php
//// base-a.php <?hh class A { const int C = 3; } //// base-b.php <?hh class B extends A { } //// base-c.php <?hh class C extends B {} //// base-use.php <?hh function take_int(int $_): void {} function use_a_const(): void { take_int(A::C); } function use_b_const(): void { take_int(B::C); } function use_c_const(): void { take_int(C::C); } //// changed-a.php <?hh class A { const bool C = false; } //// changed-b.php <?hh class B extends A { } //// changed-c.php <?hh class C extends B {} //// changed-use.php <?hh function take_int(int $_): void {} function use_a_const(): void { take_int(A::C); } function use_b_const(): void { take_int(B::C); } function use_c_const(): void { take_int(C::C); }
PHP
hhvm/hphp/hack/test/fanout/class_extends_class_impl_interface.php
//// base-impl.php <?hh class Impl extends CParent implements IParent {} //// base-iparent.php <?hh interface IParent { public function genInt(): int; } //// base-parent.php <?hh class CParent { public function genInt(): int { return 42; } } //// changed-impl.php <?hh class Impl extends CParent implements IParent {} //// changed-iparent.php <?hh interface IParent { public function genInt(): int; } //// changed-parent.php <?hh class CParent { public function genInt(): ?int { return 42; } }
PHP
hhvm/hphp/hack/test/fanout/class_level_where_example.php
//// base-a.php <?hh <<file:__EnableUnstableFeatures('class_level_where')>> //// changed-a.php <?hh <<file:__EnableUnstableFeatures('class_level_where')>>
PHP
hhvm/hphp/hack/test/fanout/class_method_change_origin.php
//// base-a.php <?hh class A { public function foo(): void {} } //// base-b.php <?hh class B extends A { public function foo(): void {} } //// base-c.php <?hh class C extends B {} //// base-use.php <?hh function use_a_foo(): void { (new A())->foo(); } function use_b_foo(): void { (new B())->foo(); } function use_c_foo(): void { (new C())->foo(); } //// changed-a.php <?hh class A { // Position change here public function foo(): void {} } //// changed-b.php <?hh class B extends A { // Removing B::foo will change the origin field of C::foo and thus // trigger a type check of places that use C::foo! Weird! } //// changed-c.php <?hh class C extends B {} //// changed-use.php <?hh function use_a_foo(): void { (new A())->foo(); } function use_b_foo(): void { (new B())->foo(); } function use_c_foo(): void { (new C())->foo(); }
PHP
hhvm/hphp/hack/test/fanout/class_method_change_pos.php
//// base-a.php <?hh class A { public function foo(): void {} } //// base-b.php <?hh class B extends A { public function foo(): void {} } //// base-c.php <?hh class C extends B {} //// base-use.php <?hh function use_a_foo(): void { (new A())->foo(); } function use_b_foo(): void { (new B())->foo(); } function use_c_foo(): void { (new C())->foo(); } //// changed-a.php <?hh class A { public function foo(): void {} } //// changed-b.php <?hh class B extends A { public function foo(): void {} } //// changed-c.php <?hh class C extends B {} //// changed-use.php <?hh function use_a_foo(): void { (new A())->foo(); } function use_b_foo(): void { (new B())->foo(); } function use_c_foo(): void { (new C())->foo(); }
PHP
hhvm/hphp/hack/test/fanout/class_method_change_visibility.php
//// base-a.php <?hh class A { public function foo(): void {} } //// base-b.php <?hh class B extends A { } //// base-c.php <?hh class C extends B {} //// base-use.php <?hh function use_a_foo(): void { (new A())->foo(); } function use_b_foo(): void { (new B())->foo(); } function use_c_foo(): void { (new C())->foo(); } //// changed-a.php <?hh class A { private function foo(): void {} } //// changed-b.php <?hh class B extends A { } //// changed-c.php <?hh class C extends B {} //// changed-use.php <?hh function use_a_foo(): void { (new A())->foo(); } function use_b_foo(): void { (new B())->foo(); } function use_c_foo(): void { (new C())->foo(); }
PHP
hhvm/hphp/hack/test/fanout/class_rename_tparam.php
//// base-a.php <?hh class A<T> {} //// base-b.php <?hh class B<T> extends A<T> {} //// base-use-b.php <?hh function use_b(): void { $_ = new B<int>(); } //// changed-a.php <?hh class A<TU> {} //// changed-b.php <?hh class B<T> extends A<T> {} //// changed-use-b.php <?hh function use_b(): void { $_ = new B<int>(); }
PHP
hhvm/hphp/hack/test/fanout/class_type_const_change_origin.php
//// base-a.php <?hh class A { const type T = arraykey; } //// base-b.php <?hh class B extends A { const type T = arraykey; } //// base-c.php <?hh class C extends B {} //// base-use.php <?hh function accept_a_const(A::T $_): void {} function accept_b_const(B::T $_): void {} function accept_c_const(C::T $_): void {} function use_a_const(): void { accept_a_const(3); } function use_b_const(): void { accept_b_const(3); } function use_c_const(): void { accept_c_const(3); } //// changed-a.php <?hh class A { const type T = arraykey; } //// changed-b.php <?hh class B extends A { // Note that not only the origin changes! of B::T and C::T, so // it's a bit weird we type check the use sites of B::T and C::T! } //// changed-c.php <?hh class C extends B {} //// changed-use.php <?hh function accept_a_const(A::T $_): void {} function accept_b_const(B::T $_): void {} function accept_c_const(C::T $_): void {} function use_a_const(): void { accept_a_const(3); } function use_b_const(): void { accept_b_const(3); } function use_c_const(): void { accept_c_const(3); }
PHP
hhvm/hphp/hack/test/fanout/class_type_const_change_type.php
//// base-a.php <?hh class A { const type T = arraykey; } //// base-b.php <?hh class B extends A { const type T = arraykey; } //// base-c.php <?hh class C extends B {} //// base-use.php <?hh function accept_a_const(A::T $_): void {} function accept_b_const(B::T $_): void {} function accept_c_const(C::T $_): void {} function use_a_const(): void { accept_a_const(3); } function use_b_const(): void { accept_b_const(3); } function use_c_const(): void { accept_c_const(3); } //// changed-a.php <?hh class A { const type T = int; } //// changed-b.php <?hh class B extends A { const type T = arraykey; } //// changed-c.php <?hh class C extends B {} //// changed-use.php <?hh function accept_a_const(A::T $_): void {} function accept_b_const(B::T $_): void {} function accept_c_const(C::T $_): void {} function use_a_const(): void { accept_a_const(3); } function use_b_const(): void { accept_b_const(3); } function use_c_const(): void { accept_c_const(3); }
PHP
hhvm/hphp/hack/test/fanout/class_type_const_change_type2.php
//// base-a.php <?hh class A { const type T = arraykey; } //// base-b.php <?hh class B extends A {} //// base-c.php <?hh class C extends B {} //// base-use.php <?hh function accept_a_const(A::T $_): void {} function accept_b_const(B::T $_): void {} function accept_c_const(C::T $_): void {} function use_a_const(): void { accept_a_const(3); } function use_b_const(): void { accept_b_const(3); } function use_c_const(): void { accept_c_const(3); } //// changed-a.php <?hh class A { const type T = int; } //// changed-b.php <?hh class B extends A {} //// changed-c.php <?hh class C extends B {} //// changed-use.php <?hh function accept_a_const(A::T $_): void {} function accept_b_const(B::T $_): void {} function accept_c_const(C::T $_): void {} function use_a_const(): void { accept_a_const(3); } function use_b_const(): void { accept_b_const(3); } function use_c_const(): void { accept_c_const(3); }
PHP
hhvm/hphp/hack/test/fanout/class_use_trait_extends_class.php
//// base-impl.php <?hh class Impl extends CParent { use MyTrait; } //// base-trait.php <?hh trait MyTrait { public function genInt(): int { return 42; } } //// base-parent.php <?hh class CParent { public function genInt(): int { return 42; } } //// changed-impl.php <?hh class Impl extends CParent { use MyTrait; } //// changed-trait.php <?hh trait MyTrait { public function genInt(): ?int { return 42; } } //// changed-parent.php <?hh class CParent { public function genInt(): int { return 42; } }
PHP
hhvm/hphp/hack/test/fanout/class_use_trait_impl_interface.php
//// base-impl.php <?hh final class Impl implements IChild { use TImpl; } //// base-child.php <?hh interface IChild extends IParent {} //// base-parent.php <?hh interface IParent { public function genInt(): Awaitable<int>; } //// base-trait.php <?hh trait TImpl { public async function genInt(): Awaitable<int> { return 42; } } //// changed-impl.php <?hh final class Impl implements IChild { use TImpl; } //// changed-child.php <?hh interface IChild extends IParent {} //// changed-parent.php <?hh interface IParent { public function genInt(): Awaitable<int>; } //// changed-trait.php <?hh trait TImpl { public async function genInt(): Awaitable<?int> { return 42; } }
PHP
hhvm/hphp/hack/test/fanout/construct_affect_dependents.php
//// base-a.php <?hh class A { public function __construct(int $_) {} } //// base-b.php <?hh class B extends A {} //// base-c.php <?hh class C extends B {} //// base-f.php <?hh function f() : void { new C(0); } //// changed-a.php <?hh class A { public function __construct(int $_) {} } //// changed-b.php <?hh class B extends A { public function __construct(int $x, string $_) { parent::__construct($x); } } //// changed-c.php <?hh class C extends B {} //// changed-f.php <?hh function f() : void { new C(0); }
PHP
hhvm/hphp/hack/test/fanout/const_change_pos.php
//// base-foo.php <?hh const int C = 3; //// base-a.php <?hh function get_c(): int { return C; } //// changed-foo.php <?hh // Position change here const int C = 3; //// changed-a.php <?hh function get_c(): int { return C; }
PHP
hhvm/hphp/hack/test/fanout/const_change_type.php
//// base-foo.php <?hh const int C = 3; //// base-a.php <?hh function get_c(): int { return C; } //// changed-foo.php <?hh const string C = 3; //// changed-a.php <?hh function get_c(): int { return C; }
PHP
hhvm/hphp/hack/test/fanout/const_change_value.php
//// base-foo.php <?hh const int C = 3; //// base-a.php <?hh function get_c(): int { return C; } //// changed-foo.php <?hh const int C = 5; //// changed-a.php <?hh function get_c(): int { return C; }
PHP
hhvm/hphp/hack/test/fanout/extend_add_base_method_moves_other_class.php
//// base-a.php <?hh class A {} class X {} //// base-b.php <?hh class B extends A { public function foo(): int { return 0; } } class Y extends X {} //// changed-a.php <?hh class A { public function foo(): arraykey { return "s"; } // Added method } class X {} //// changed-b.php <?hh class B extends A { public function foo(): int { return 0; } } class Y extends X {}
PHP
hhvm/hphp/hack/test/fanout/extend_add_base_method_unch_other_class.php
//// base-a.php <?hh class X {} class A {} //// base-b.php <?hh class Y extends X {} class B extends A { public function foo(): int { return 0; } } //// changed-a.php <?hh class X {} class A { public function foo(): arraykey { return "s"; } // Added method } //// changed-b.php <?hh class Y extends X {} class B extends A { public function foo(): int { return 0; } }
PHP
hhvm/hphp/hack/test/fanout/fun_change_deprecated_msg.php
//// base-foo.php <?hh <<__Deprecated("deprecated")>> function foo(): void {} //// base-a.php <?hh function take_int(int $_): void {} class A { public function bar(): void { take_int(foo()); } } //// changed-foo.php <?hh <<__Deprecated("this function is deprecated")>> function foo(): void {} //// changed-a.php <?hh function take_int(int $_): void {} class A { public function bar(): void { take_int(foo()); } }
PHP
hhvm/hphp/hack/test/fanout/fun_change_pos.php
//// base-foo.php <?hh function foo(): void {} //// base-a.php <?hh class A { public function bar(): void { foo(); } } //// changed-foo.php <?hh // Position change here function foo(): void {} //// changed-a.php <?hh class A { public function bar(): void { foo(); } }
PHP
hhvm/hphp/hack/test/fanout/fun_change_pos_with_error.php
//// base-foo.php <?hh function foo(): void {} //// base-a.php <?hh function take_int(int $_): void {} class A { public function bar(): void { take_int(foo()); } } //// changed-foo.php <?hh // Position change here, check in the logs whether the error // position is properly updated. // // Note that A will not necessarily be in the fanout, in hh_server // we automatically re-typecheck all files with errors. function foo(): void {} //// changed-a.php <?hh function take_int(int $_): void {} class A { public function bar(): void { take_int(foo()); } }
PHP
hhvm/hphp/hack/test/fanout/fun_change_ret_type.php
//// base-foo.php <?hh function foo(): string { return "s"; } //// base-a.php <?hh function take_string(string $_): void {} class A { public function bar(): void { take_string(foo()); } } //// changed-foo.php <?hh function foo(): int { return 4; } //// changed-a.php <?hh function take_string(string $_): void {} class A { public function bar(): void { take_string(foo()); } }
PHP
hhvm/hphp/hack/test/fanout/newtype_change_inner_type.php
//// base-foo.php <?hh newtype Y = int; //// base-a.php <?hh function take_y(Y $_): void {} //// changed-foo.php <?hh newtype Y = string; //// changed-a.php <?hh function take_y(Y $_): void {}
PHP
hhvm/hphp/hack/test/fanout/newtype_change_pos.php
//// base-foo.php <?hh newtype Y = int; //// base-a.php <?hh function take_y(Y $_): void {} //// changed-foo.php <?hh // Position change here newtype Y = int; //// changed-a.php <?hh function take_y(Y $_): void {}
PHP
hhvm/hphp/hack/test/fanout/newtype_change_tparm.php
//// base-foo.php <?hh newtype Y<T> = int; //// base-a.php <?hh function take_y<T>(Y<T> $_): void {} //// changed-foo.php <?hh newtype Y<T as int> = string; //// changed-a.php <?hh function take_y<<<__Explicit>> T>(Y<T> $_): void {}
PHP
hhvm/hphp/hack/test/fanout/remove_method_hierarchy.php
//// base-a.php <?hh class A { public function foo(string $c): void {} } //// base-b.php <?hh class B extends A { public function foo(arraykey $c): void {} } //// base-c.php <?hh class C extends B {} //// base-d.php <?hh class D extends C { public function foo(nonnull $c): void {} } //// base-use.php <?hh function f(C $c): void { $c->foo(0); } //// changed-a.php <?hh class A { public function foo(string $c): void {} } //// changed-b.php <?hh class B extends A {} //// changed-c.php <?hh class C extends B {} //// changed-d.php <?hh class D extends C { public function foo(nonnull $c): void {} } //// changed-use.php <?hh function f(C $c): void { $c->foo(0); }
PHP
hhvm/hphp/hack/test/fanout/remove_prop_hierarchy.php
//// base-a.php <?hh class A { public string $foo = ""; } //// base-b.php <?hh class B extends A { public int $foo = 0; } //// base-c.php <?hh class C extends B {} //// base-d.php <?hh class D extends C { public int $foo = 0; } //// base-use.php <?hh function f(C $c): void { $c->foo = 0; } //// changed-a.php <?hh class A { public string $foo = 0; } //// changed-b.php <?hh class B extends A {} //// changed-c.php <?hh class C extends B {} //// changed-d.php <?hh class D extends C { public int $foo = 0; } //// changed-use.php <?hh function f(C $c): void { $c->foo = 0; }
PHP
hhvm/hphp/hack/test/fanout/remove_static_method_hierarchy.php
//// base-a.php <?hh class A { public static function foo(string $c): void {} } //// base-b.php <?hh class B extends A { public static function foo(arraykey $c): void {} } //// base-c.php <?hh class C extends B {} //// base-d.php <?hh class D extends C { public static function foo(nonnull $c): void {} } //// base-use.php <?hh function f(): void { C::foo(0); } //// changed-a.php <?hh class A { public static function foo(string $c): void {} } //// changed-b.php <?hh class B extends A {} //// changed-c.php <?hh class C extends B {} //// changed-d.php <?hh class D extends C { public static function foo(nonnull $c): void {} } //// changed-use.php <?hh function f(): void { C::foo(0); }
PHP
hhvm/hphp/hack/test/fanout/simple_extend.php
//// base-a.php <?hh class A {} //// base-b.php <?hh class B extends A {} //// changed-a.php <?hh class A { public function foo(): void {} } //// changed-b.php <?hh class B extends A {}
PHP
hhvm/hphp/hack/test/fanout/simple_extend_method_position_change.php
//// base-a.php <?hh class A { public function foo(): arraykey { return "s"; } } //// base-b.php <?hh class B extends A { public function foo(): int { return 0; } } //// changed-a.php <?hh class A { // Position change public function foo(): arraykey { return "s"; } } //// changed-b.php <?hh class B extends A { public function foo(): int { return 0; } }
PHP
hhvm/hphp/hack/test/fanout/simple_extend_no_change.php
//// base-a.php <?hh class A {} //// base-b.php <?hh class B extends A {} //// changed-a.php <?hh class A {} //// changed-b.php <?hh class B extends A {}
PHP
hhvm/hphp/hack/test/fanout/simple_extend_override_method.php
//// base-a.php <?hh class A {} //// base-b.php <?hh class B extends A { public function foo(): int { return 0; } } //// changed-a.php <?hh class A { public function foo(): arraykey { return "s"; } } //// changed-b.php <?hh class B extends A { public function foo(): int { return 0; } }
PHP
hhvm/hphp/hack/test/fanout/simple_require_class_01.php
//// base-a.php <?hh <<file:__EnableUnstableFeatures('require_class')>> trait A { require class C; } //// base-b.php <?hh final class C { use A; } //// changed-a.php <?hh <<file:__EnableUnstableFeatures('require_class')>> trait A { require class C; } //// changed-b.php <?hh final class C { use A; public function foo(): void {} }
PHP
hhvm/hphp/hack/test/fanout/simple_require_class_02.php
//// base-a.php <?hh <<file:__EnableUnstableFeatures('require_class')>> trait A { require class C; public function foo(): int { return $this->bar(); } } //// base-b.php <?hh final class C { use A; public function bar(): int { return 42; } } //// changed-a.php <?hh <<file:__EnableUnstableFeatures('require_class')>> trait A { require class C; public function foo(): int { return $this->bar(); } } //// changed-b.php <?hh final class C { use A; public function bar(): string { return "hello"; } }
PHP
hhvm/hphp/hack/test/fanout/simple_require_class_03.php
//// base-a.php <?hh <<file:__EnableUnstableFeatures('require_class')>> trait A { require class D; public function foo(): int { return $this->bar(); } } //// base-b.php <?hh class C { public function bar(): int { return 42; } } //// base-c.php <?hh final class D extends C { use A; } //// changed-a.php <?hh <<file:__EnableUnstableFeatures('require_class')>> trait A { require class D; public function foo(): int { return $this->bar(); } } //// changed-b.php <?hh class C { public function bar(): string { return "hello"; } } //// changed-c.php <?hh final class D extends C { use A; }
PHP
hhvm/hphp/hack/test/fanout/simple_require_class_04.php
//// base-a.php <?hh <<file:__EnableUnstableFeatures('require_class')>> trait A { require class C; } //// base-b.php <?hh final class C { use A; } //// changed-a.php <?hh <<file:__EnableUnstableFeatures('require_class')>> trait A { require class C; } //// changed-b.php <?hh final class C {}
PHP
hhvm/hphp/hack/test/fanout/simple_require_extends_01.php
//// base-a.php <?hh trait A { require extends C; } //// base-b.php <?hh class C {} class D extends C { use A; } //// changed-a.php <?hh trait A { require extends C; } //// changed-b.php <?hh class C { public function foo(): void {} } class D extends C { use A; }
PHP
hhvm/hphp/hack/test/fanout/simple_require_extends_02.php
//// base-a.php <?hh trait A { require extends C; public function foo(): int { return $this->bar(); } } //// base-b.php <?hh class C { public function bar(): int { return 42; } } class D extends C { use A; } //// changed-a.php <?hh trait A { require extends C; public function foo(): int { return $this->bar(); } } //// changed-b.php <?hh class C { public function bar(): string { return "hello"; } } class D extends C { use A; }
PHP
hhvm/hphp/hack/test/fanout/switch.php
//// base-a.php <?hh enum E: int as int { A = 0; B = 1; } //// base-b.php <?hh function foo(E $e): void { switch ($e) { case E::A: case E::B: return; } } //// changed-a.php <?hh enum E: int as int { A = 0; B = 1; C = 2; } //// changed-b.php <?hh function foo(E $e): void { switch ($e) { case E::A: case E::B: return; } }
PHP
hhvm/hphp/hack/test/fanout/switch_includes.php
//// base-a.php <?hh enum E: int as int { A = 0; B = 1; } //// base-b.php <?hh enum F: int as int { use E; } //// base-foo.php <?hh function foo(F $e): void { switch ($e) { case F::A: case F::B: return; } } //// changed-a.php <?hh enum E: int as int { A = 0; B = 1; C = 2; } //// changed-b.php <?hh enum F: int as int { use E; } //// changed-foo.php <?hh function foo(F $e): void { switch ($e) { case F::A: case F::B: return; } }
PHP
hhvm/hphp/hack/test/fanout/type_alias_chain.php
//// base-a.php <?hh type X = int; //// base-b.php <?hh type Y = X; //// base-c.php <?hh function expect_int(int $y): void {} function f(Y $y): void { expect_int($y); } //// changed-a.php <?hh type X = string; //// changed-b.php <?hh type Y = X; //// changed-c.php <?hh function expect_int(int $y): void {} function f(Y $y): void { expect_int($y); }
PHP
hhvm/hphp/hack/test/fanout/type_change_inner_type.php
//// base-foo.php <?hh newtype Y = int; //// base-a.php <?hh function take_y(Y $_): void {} //// changed-foo.php <?hh newtype Y = string; //// changed-a.php <?hh function take_y(Y $_): void {}
PHP
hhvm/hphp/hack/test/fanout/type_change_pos.php
//// base-foo.php <?hh type Y = int; //// base-a.php <?hh function take_y(Y $_): void {} //// changed-foo.php <?hh // Position change here type Y = int; //// changed-a.php <?hh function take_y(Y $_): void {}
PHP
hhvm/hphp/hack/test/fanout/type_change_tparm.php
//// base-foo.php <?hh type Y<T> = int; //// base-a.php <?hh function take_y<T>(Y<T> $_): void {} //// changed-foo.php <?hh type Y<T as int> = string; //// changed-a.php <?hh function take_y<<<__Explicit>> T>(Y<T> $_): void {}
PHP
hhvm/hphp/hack/test/fanout/unbound_names_appear.php
//// base-a.php <?hh class AA { public static function foo(): void {} public function bar(): void {} } //// base-b.php <?hh function f(): void { AA::class; } //// base-c.php <?hh type X = vec<AA>; //// base-d.php <?hh function g(): void { AA::foo(); } //// base-e.php <?hh function h(AA $a): void {} //// base-f.php <?hh function i(AA $a): void { $a->bar(); } //// base-dict.php <?hh function f_dict(): void { dict[ AA::class => 0, ]; } //// base-shape.php <?hh function f_shp(): void { shape( AA::class => 0, ); } //// changed-a.php <?hh class A { public static function foo(): void {} public function bar(): void {} } //// changed-b.php <?hh function f(): void { AA::class; } //// changed-c.php <?hh type X = vec<AA>; //// changed-d.php <?hh function g(): void { AA::foo(); } //// changed-e.php <?hh function h(AA $a): void {} //// changed-f.php <?hh function i(AA $a): void { $a->bar(); } //// changed-dict.php <?hh function f_dict(): void { dict[ AA::class => 0, ]; } //// changed-shape.php <?hh function f_shp(): void { shape( AA::class => 0, ); }
PHP
hhvm/hphp/hack/test/fanout/unbound_names_disappear.php
//// base-a.php <?hh class A { public static function foo(): void {} public function bar(): void {} } //// base-b.php <?hh function f(): void { AA::class; } //// base-c.php <?hh type X = vec<AA>; //// base-d.php <?hh function g(): void { AA::foo(); } //// base-e.php <?hh function h(AA $a): void {} //// base-f.php <?hh function i(AA $a): void { $a->bar(); } //// base-dict.php <?hh function f_dict(): void { dict[ AA::class => 0, ]; } //// base-shape.php <?hh function f_shp(): void { shape( AA::class => 0, ); } //// changed-a.php <?hh class AA { public static function foo(): void {} public function bar(): void {} } //// changed-b.php <?hh function f(): void { AA::class; } //// changed-c.php <?hh type X = vec<AA>; //// changed-d.php <?hh function g(): void { AA::foo(); } //// changed-e.php <?hh function h(AA $a): void {} //// changed-f.php <?hh function i(AA $a): void { $a->bar(); } //// changed-dict.php <?hh function f_dict(): void { dict[ AA::class => 0, ]; } //// changed-shape.php <?hh function f_shp(): void { shape( AA::class => 0, ); }
PHP
hhvm/hphp/hack/test/fanout/modules/module-add-class-module.php
//// base-decls.php <?hh <<file: __EnableUnstableFeatures('modules')>> new module A {} //// changed-decls.php <?hh <<file: __EnableUnstableFeatures('modules')>> new module A {} //// base-foobar.php <?hh <<file: __EnableUnstableFeatures('modules')>> class Foobar { public function foo(): void {} } //// changed-foobar.php <?hh <<file: __EnableUnstableFeatures('modules')>> module A; class Foobar { public function foo(): void {} } //// base-bing.php <?hh <<file: __EnableUnstableFeatures('modules')>> function test(Foobar $x): void { $x->foo(); } //// changed-bing.php <?hh <<file: __EnableUnstableFeatures('modules')>> function test(Foobar $x): void { $x->foo(); }
PHP
hhvm/hphp/hack/test/fanout/modules/module-add-ref-to-nonexist.php
//// base-decls.php <?hh // If a reference to a module is added without the corresponding module // declaration, we want to ensure that we properly invalidate any type that // refers to the non-existent declaration s.t. we properly recheck any files // with errors. //// changed-decls.php <?hh <<file: __EnableUnstableFeatures('modules')>> new module A {} //// base-foobar.php <?hh <<file: __EnableUnstableFeatures('modules')>> module A; class Foobar {} //// changed-foobar.php <?hh <<file: __EnableUnstableFeatures('modules')>> module A; class Foobar {}