language
stringlengths 0
24
| filename
stringlengths 9
214
| code
stringlengths 99
9.93M
|
---|---|---|
PHP | hhvm/hphp/hack/test/requireclass/typing/methods_philippe_03.bad.php | <?hh
// Copyright (c) Meta Platforms, Inc. and affiliates.
//
// This source code is licensed under the MIT license found in the
// LICENSE file in the "hack" directory of this source tree.
<<file: __EnableUnstableFeatures('require_class')>>
interface IPajoux1 {
public function foo(int $a): void;
}
interface IPajoux2 {
public function foo(int $a, ?int $b = null): void;
}
final class Pajoux {
use TPajoux;
public function foo(int $a, ?int $b = null): void {}
}
trait TPajoux implements IPajoux1, IPajoux2 {
public function foo(int $a): void {}
require class Pajoux;
} |
PHP | hhvm/hphp/hack/test/requireclass/typing/methods_trait_conflict_01.bad.php | <?hh
// Copyright (c) Meta Platforms, Inc. and affiliates.
//
// This source code is licensed under the MIT license found in the
// LICENSE file in the "hack" directory of this source tree.
final class TheProblem {
public static function testDemo(): void {
$demo = new Demo();
$demo->asEnt();
}
}
final class Demo {
use TParentDemo;
public function asEnt(): void {
echo('in TParentDemo');
}
}
trait TParentDemo {
require class Demo;
use TChild1Demo;
use TChild2Demo;
}
trait TChild1Demo {
public function asEnt(): void {
echo('in TChild1Demo');
}
}
trait TChild2Demo {
public function asEnt(): void {
echo('in TChild2Demo');
}
} |
PHP | hhvm/hphp/hack/test/requireclass/typing/multiple_01.good.php | <?hh
// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
<<file:__EnableUnstableFeatures('require_class')>>
trait T1 {
require class C;
public function foo(): void {
$this->bar();
}
}
trait T2 {
require class C;
public function bar(): void {
$this->gee();
}
}
final class C {
use T1, T2;
public function gee(): void {}
} |
PHP | hhvm/hphp/hack/test/requireclass/typing/parent_01.bad.php | <?hh
// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
// Ideally Hack should accept this
<<file:__EnableUnstableFeatures('require_class')>>
trait T {
require class D;
public function foo(): void {
parent::bar();
}
}
class C {
public static function bar(): void {}
}
final class D extends C {
use T;
} |
PHP | hhvm/hphp/hack/test/requireclass/typing/parent_02.bad.php | <?hh
// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
// Ideally Hack should report an error saying that parent::bar returns
// an arraykey, not an int
<<file:__EnableUnstableFeatures('require_class')>>
function expect_int(int $x): void {}
trait T {
require class D;
public function foo(): void {
expect_int(parent::bar());
}
}
class C {
public static function bar(): arraykey {
return "hello";
}
}
final class D extends C {
use T;
public static function bar(): int {
return 42;
}
}
<<__EntryPoint>>
function main(): void {
echo "start\n";
(new D())->foo();
} |
PHP | hhvm/hphp/hack/test/requireclass/typing/protected_01.good.php | <?hh
// Copyright (c) Meta Platforms, Inc. and affiliates.
//
// This source code is licensed under the MIT license found in the
// LICENSE file in the "hack" directory of this source tree.
<<file:__EnableUnstableFeatures('require_class')>>
trait T {
require class C;
public function foo(): void { $this->bar(); }
}
class D {
protected function bar(): void {}
}
final class C extends D {
use T;
} |
PHP | hhvm/hphp/hack/test/requireclass/typing/protected_02.good.php | <?hh
// Copyright (c) Meta Platforms, Inc. and affiliates.
//
// This source code is licensed under the MIT license found in the
// LICENSE file in the "hack" directory of this source tree.
<<file:__EnableUnstableFeatures('require_class')>>
final class C {
use T;
protected function foo(): void {}
}
trait T {
require class C;
public function bar(): void {
$this->foo();
}
} |
PHP | hhvm/hphp/hack/test/requireclass/typing/reqcls_elements_synthesised_01.good.php | <?hh
// Copyright (c) Meta Platforms, Inc. and affiliates.
//
// This source code is licensed under the MIT license found in the
// LICENSE file in the "hack" directory of this source tree.
<<file:
__EnableUnstableFeatures('method_trait_diamond', 'require_class'),
>>
trait T1 {
public function foo(): void {}
}
trait T2 {
use T1;
require class C;
}
final class C {
use T2;
public function foo(): void {}
} |
PHP | hhvm/hphp/hack/test/requireclass/typing/requireclass_abstract_01.bad.php | <?hh
// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
<<file:__EnableUnstableFeatures('require_class')>>
abstract class C {
use T;
}
trait T {
require class C;
} |
PHP | hhvm/hphp/hack/test/requireclass/typing/requireclass_abstract_02.good.php | <?hh
// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
<<file:__EnableUnstableFeatures('require_class')>>
final abstract class C {
use T;
}
trait T {
require class C;
} |
PHP | hhvm/hphp/hack/test/requireclass/typing/requireclass_conflict_01.bad.php | <?hh
// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
<<file:__EnableUnstableFeatures('require_class')>>
final class C {}
trait T1 { require class C; }
trait T2 { require extends C; }
trait T { use T1, T2; } |
PHP | hhvm/hphp/hack/test/requireclass/typing/requireclass_conflict_02.bad.php | <?hh
// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
<<file:__EnableUnstableFeatures('require_class')>>
final class C {}
trait T {
require class C;
require extends C;
} |
PHP | hhvm/hphp/hack/test/requireclass/typing/requireclass_generic_01.bad.php | <?hh
// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
<<file:__EnableUnstableFeatures('require_class')>>
trait MyTrait {
require class C<int>;
}
final class C<T> {
use MyTrait;
} |
PHP | hhvm/hphp/hack/test/requireclass/typing/requireclass_generic_02.bad.php | <?hh
// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
<<file:__EnableUnstableFeatures('require_class')>>
trait MyTrait {
require class C;
}
final class C<T> {
use MyTrait;
} |
PHP | hhvm/hphp/hack/test/requireclass/typing/requireclass_generic_03.bad.php | <?hh
// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
<<file:__EnableUnstableFeatures('require_class')>>
trait MyTrait {
require class C<int>;
}
final class C<T> {
} |
PHP | hhvm/hphp/hack/test/requireclass/typing/requireclass_generic_04.bad.php | <?hh
<<file:__EnableUnstableFeatures('require_class')>>
interface I {}
trait T1<T> {
require class T;
}
trait T2<T> {
require extends T;
} |
PHP | hhvm/hphp/hack/test/requireclass/typing/requireclass_hierarchy_01.good.php | <?hh
// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
<<file:__EnableUnstableFeatures('require_class')>>
trait T {
require class C;
}
final class C {
use T;
} |
PHP | hhvm/hphp/hack/test/requireclass/typing/requireclass_hierarchy_02.bad.php | <?hh
// Copyright (c) Meta Platforms, Inc. and affiliates.
//
// This source code is licensed under the MIT license found in the
// LICENSE file in the "hack" directory of this source tree.
<<file:__EnableUnstableFeatures('require_class')>>
trait T {
require class C;
}
final class C {
use T;
}
final class D {
use T;
} |
PHP | hhvm/hphp/hack/test/requireclass/typing/requireclass_hierarchy_03.bad.php | <?hh
// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
<<file:__EnableUnstableFeatures('require_class')>>
trait T {
require class C;
} |
PHP | hhvm/hphp/hack/test/requireclass/typing/requireclass_hierarchy_04.bad.php | <?hh
// Copyright (c) Meta Platforms, Inc. and affiliates.
//
// This source code is licensed under the MIT license found in the
// LICENSE file in the "hack" directory of this source tree.
<<file:__EnableUnstableFeatures('require_class')>>
trait T1 {
require class C;
}
trait T2 {
use T1;
}
final class C { use T2; }
class D {
use T2;
} |
PHP | hhvm/hphp/hack/test/requireclass/typing/requireclass_nonfinal_01.bad.php | <?hh
// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
<<file:__EnableUnstableFeatures('require_class')>>
trait T {
require class C;
}
class C {
use T;
} |
PHP | hhvm/hphp/hack/test/requireclass/typing/requireclass_not_experimental.good.php | <?hh
// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
trait T {
require class C;
}
final class C {
use T;
} |
PHP | hhvm/hphp/hack/test/requireclass/typing/requireclass_nouse_01.bad.php | <?hh
// Copyright (c) Meta Platforms, Inc. and affiliates.
//
// This source code is licensed under the MIT license found in the
// LICENSE file in the "hack" directory of this source tree.
<<file: __EnableUnstableFeatures('require_class')>>
trait T1 {
require class C;
}
trait T2 {
use T1;
}
final class C {
} |
PHP | hhvm/hphp/hack/test/requireclass/typing/requireclass_nouse_02.bad.php | <?hh
// Copyright (c) Meta Platforms, Inc. and affiliates.
//
// This source code is licensed under the MIT license found in the
// LICENSE file in the "hack" directory of this source tree.
<<file: __EnableUnstableFeatures('require_class')>>
trait T1 {
require class C;
}
trait T2 {
use T1;
}
final class C {
use T1;
} |
PHP | hhvm/hphp/hack/test/requireclass/typing/requireclass_nouse_03.good.php | <?hh
// Copyright (c) Meta Platforms, Inc. and affiliates.
//
// This source code is licensed under the MIT license found in the
// LICENSE file in the "hack" directory of this source tree.
<<file: __EnableUnstableFeatures('require_class')>>
trait T1 {
require class C;
}
trait T2 {
use T1;
}
final class C {
use T2;
} |
PHP | hhvm/hphp/hack/test/requireclass/typing/requireclass_syntax_01.bad.php | <?hh
// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
// bad: require class is only allowed inside traits
<<file:__EnableUnstableFeatures('require_class')>>
class C {}
interface IT {
require class C;
}
class D {
require class C;
} |
PHP | hhvm/hphp/hack/test/requireclass/typing/requireclass_syntax_02.bad.php | <?hh
// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
// bad: require is can only be used with classes
<<file:__EnableUnstableFeatures('require_class')>>
interface I {}
trait Tr {}
trait T2 {
require class I;
}
trait T3 {
require class Tr;
} |
PHP | hhvm/hphp/hack/test/requireclass/typing/self_01.good.php | <?hh
// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
<<file:__EnableUnstableFeatures('require_class')>>
trait T {
require class C;
public function foo(): void {
self::bar();
}
}
final class C {
use T;
public static function bar(): void {}
} |
PHP | hhvm/hphp/hack/test/requireclass/typing/self_02.good.php | <?hh
// Copyright (c) Meta Platforms, Inc. and affiliates.
//
// This source code is licensed under the MIT license found in the
// LICENSE file in the "hack" directory of this source tree.
<<file:__EnableUnstableFeatures('require_class')>>
trait T {
require class C;
public static function foo(): void { self::bar(); }
}
class D {
public static function bar(): void { }
}
final class C extends D {
use T;
} |
PHP | hhvm/hphp/hack/test/requireclass/typing/static_01.good.php | <?hh
// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
<<file:__EnableUnstableFeatures('require_class')>>
trait T {
require class C;
public function foo(): void {
static::bar();
}
}
final class C {
use T;
public static function bar(): void {}
} |
PHP | hhvm/hphp/hack/test/requireclass/typing/static_access_01.bad.php | <?hh
// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
<<file:__EnableUnstableFeatures('require_class')>>
trait T {
require class C;
public function foo(): void { C::bar(); }
}
final class C {
use T;
} |
PHP | hhvm/hphp/hack/test/requireclass/typing/static_access_02.good.php | <?hh
// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
<<file:__EnableUnstableFeatures('require_class')>>
trait T {
require class C;
public static function foo(): void { C::bar(); }
}
final class C {
use T;
public static function bar(): void { C::foo(); }
} |
PHP | hhvm/hphp/hack/test/requireclass/typing/static_access_03.bad.php | <?hh
// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
<<file:__EnableUnstableFeatures('require_class')>>
trait T {
require class C;
}
final class C {
use T;
public function foo(): void { C::bar(); }
} |
PHP | hhvm/hphp/hack/test/requireclass/typing/static_property_01.bad.php | <?hh
// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
<<file:__EnableUnstableFeatures('require_class')>>
trait T {
require class C;
public function foo(): int { return C::$x; }
}
final class C {
use T;
} |
PHP | hhvm/hphp/hack/test/requireclass/typing/static_property_02.good.php | <?hh
// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
<<file:__EnableUnstableFeatures('require_class')>>
trait T {
require class C;
static public int $x = 1;
public static function foo(): int { return C::$y; }
}
final class C {
use T;
static public int $y = 2;
public static function bar(): int { return C::$x; }
} |
PHP | hhvm/hphp/hack/test/requireclass/typing/typeconst_philippe_01.good.php | <?hh
// Copyright (c) Meta Platforms, Inc. and affiliates.
//
// This source code is licensed under the MIT license found in the
// LICENSE file in the "hack" directory of this source tree.
<<file: __EnableUnstableFeatures('require_class')>>
interface IViewerContextBase {}
interface IPAYViewerContext extends IViewerContextBase {}
interface ICROWViewerContext extends IViewerContextBase {}
interface IFBViewerContext extends IPAYViewerContext, ICROWViewerContext {}
interface IPajouxBase {
abstract const type TVC as IViewerContextBase;
}
interface IPajouxA {
// IPAYViewerContext <: IViewerContextBase
abstract const type TVC as IPAYViewerContext;
}
interface IPajouxB {
// ICROWViewerContext <: IViewerContextBase
abstract const type TVC as ICROWViewerContext;
}
abstract class PajouxBase {
abstract const type TVC as IViewerContextBase;
}
abstract class PajouxFB extends PajouxBase {
// IFBViewerContext <: IPAYViewerContext
// IFBViewerContext <: ICROWViewerContext
const type TVC = IFBViewerContext;
}
final class Pajoux extends PajouxFB {
// Since we extend PajouxFB, we know that:
// const type TVC = IFBViewerContext
// and thus, we know that we can safely implement IPajouxA and IPajouxB.
use TPajoux;
}
trait TPajoux implements IPajouxA, IPajouxB {
// We require class Pajoux, so the typechecker knows that:
// const type TVC = IFBViewerContext
require class Pajoux;
public function foo(this::TVC $vc) : IFBViewerContext {
return $vc;
}
public function bar(IFBViewerContext $vc) : this::TVC {
return $vc;
}
} |
PHP | hhvm/hphp/hack/test/requireclass/typing/typeconst_philippe_02.good.php | <?hh
// Copyright (c) Meta Platforms, Inc. and affiliates.
//
// This source code is licensed under the MIT license found in the
// LICENSE file in the "hack" directory of this source tree.
<<file: __EnableUnstableFeatures('require_class')>>
interface IEntUniverse {
abstract const type TViewerContext as IViewerContextBase;
}
interface IPAYEntMultiverse extends IEntUniverse {
abstract const type TViewerContext as IPAYViewerContext;
}
interface ICROWEntMultiverse extends IEntUniverse {
abstract const type TViewerContext as IPAYViewerContext;
}
final class FBEntUniverse implements IPAYEntMultiverse, ICROWEntMultiverse {
const type TViewerContext = IFBViewerContext;
}
interface IViewerContextBase {}
interface IPAYViewerContext extends IViewerContextBase {}
interface ICROWViewerContext extends IViewerContextBase {}
interface IFBViewerContext extends IPAYViewerContext, ICROWViewerContext {}
interface IPajouxBase {
abstract const type TUniverse as IEntUniverse;
const type TVC = this::TUniverse::TViewerContext;
}
interface IPajouxA extends IPajouxBase {
// IPAYViewerContext <: IViewerContextBase
abstract const type TUniverse as IPAYEntMultiverse;
}
interface IPajouxB extends IPajouxBase {
// ICROWViewerContext <: IViewerContextBase
abstract const type TUniverse as ICROWEntMultiverse;
}
interface IPajouxFB extends IPajouxBase {
const type TUniverse = FBEntUniverse;
}
abstract class PajouxFB implements IPajouxFB {}
final class Pajoux extends PajouxFB {
// Since we extend PajouxFB, we know that:
// const type TVC = IFBViewerContext
// and thus, we know that we can safely implement IPajouxA and IPajouxB.
use TPajoux;
}
trait TPajoux implements IPajouxA, IPajouxB {
// We require class Pajoux, so we should know that:
// const type TVC = IFBViewerContext
require class Pajoux;
public function foo(this::TVC $vc) : IFBViewerContext {
return $vc;
}
public function bar(IFBViewerContext $vc) : this::TVC {
return $vc;
}
} |
PHP | hhvm/hphp/hack/test/requireclass/typing/typeconst_philippe_03.good.php | <?hh
// Copyright (c) Meta Platforms, Inc. and affiliates.
//
// This source code is licensed under the MIT license found in the
// LICENSE file in the "hack" directory of this source tree.
<<file: __EnableUnstableFeatures('require_class')>>
interface PageRoles {};
interface IDefinesConst {
const type TPermissionRole = PageRoles;
}
trait ExtendPajouxTrait implements IDefinesConst {
require class Pajoux;
}
final class Pajoux implements IDefinesConst {
use ExtendPajouxTrait;
const type TPermissionRole = PageRoles;
} |
PHP | hhvm/hphp/hack/test/reserved/case_type.php | //// Foo.php
<?hh
// RUN: %hackc compile -vHack.Lang.AllowUnstableFeatures=true %s | FileCheck %s
// RUN: { %hh_single_type_check --error-format plain --custom-hhi-path %empty_directory %s 2>&1 || true; } | FileCheck %s
<<file:__EnableUnstableFeatures('case_types')>>
case type Foo = int;
// CHECK-NOT: .fatal
// CHECK-NOT: File "case_type.php--Foo.php"
//// Arraykey.php
<?hh
<<file:__EnableUnstableFeatures('case_types')>>
case type Arraykey = int;
// CHECK: Arraykey.php
// CHECK: Cannot use `Arraykey` as a type name as it is reserved
//// Bool.php
<?hh
<<file:__EnableUnstableFeatures('case_types')>>
case type Bool = int;
// CHECK: Bool.php
// CHECK: A name is expected here
//// Callable.php
<?hh
<<file:__EnableUnstableFeatures('case_types')>>
case type Callable = int;
// CHECK: Callable.php
// CHECK: Cannot use `Callable` as a type name as it is reserved
//// Classname.php
<?hh
<<file:__EnableUnstableFeatures('case_types')>>
case type Classname = int;
// CHECK-NOT: .fatal
// CHECK-NOT: File "type.php--Classname.php"
//// Darray.php
<?hh
<<file:__EnableUnstableFeatures('case_types')>>
case type Darray = int;
// CHECK: Darray.php
// CHECK: Cannot use `Darray` as a type name as it is reserved
//// Dynamic.php
<?hh
<<file:__EnableUnstableFeatures('case_types')>>
case type Dynamic = int;
// CHECK: Dynamic.php
// CHECK: Cannot use `Dynamic` as a type name as it is reserved
//// False.php
<?hh
<<file:__EnableUnstableFeatures('case_types')>>
case type False = int;
// CHECK: False.php
// CHECK: A name is expected here
//// Float.php
<?hh
<<file:__EnableUnstableFeatures('case_types')>>
case type Float = int;
// CHECK: Float.php
// CHECK: Cannot use `Float` as a type name as it is reserved
//// Int.php
<?hh
<<file:__EnableUnstableFeatures('case_types')>>
case type Int = int;
// CHECK: Int.php
// CHECK: A name is expected here
//// Mixed.php
<?hh
<<file:__EnableUnstableFeatures('case_types')>>
case type Mixed = int;
// CHECK: Mixed.php
// CHECK: Cannot use `Mixed` as a type name as it is reserved
//// Nonnull.php
<?hh
<<file:__EnableUnstableFeatures('case_types')>>
case type Nonnull = int;
// CHECK: Nonnull.php
// CHECK: Cannot use `Nonnull` as a type name as it is reserved
//// Noreturn.php
<?hh
<<file:__EnableUnstableFeatures('case_types')>>
case type Noreturn = int;
// CHECK: Noreturn.php
// CHECK: Cannot use `Noreturn` as a type name as it is reserved
//// Nothing.php
<?hh
<<file:__EnableUnstableFeatures('case_types')>>
case type Nothing = int;
// CHECK: Nothing.php
// CHECK: Cannot use `Nothing` as a type name as it is reserved
//// Null.php
<?hh
<<file:__EnableUnstableFeatures('case_types')>>
case type Null = int;
// CHECK: Null.php
// CHECK: A name is expected here
//// Num.php
<?hh
<<file:__EnableUnstableFeatures('case_types')>>
case type Num = int;
// CHECK: Num.php
// CHECK: Cannot use `Num` as a type name as it is reserved
//// Parent.php
<?hh
<<file:__EnableUnstableFeatures('case_types')>>
case type Parent = int;
// CHECK: Parent.php
// CHECK: A name is expected here
//// Resource.php
<?hh
<<file:__EnableUnstableFeatures('case_types')>>
case type Resource = int;
// CHECK: Resource.php
// CHECK: Cannot use `Resource` as a type name as it is reserved
//// Self.php
<?hh
<<file:__EnableUnstableFeatures('case_types')>>
case type Self = int;
// CHECK: Self.php
// CHECK: A name is expected here
//// Static.php
<?hh
<<file:__EnableUnstableFeatures('case_types')>>
case type Static = int;
// CHECK: Static.php
// CHECK: A name is expected here
//// String.php
<?hh
<<file:__EnableUnstableFeatures('case_types')>>
case type String = int;
// CHECK: String.php
// CHECK: A name is expected here
//// This.php
<?hh
<<file:__EnableUnstableFeatures('case_types')>>
case type This = int;
// CHECK: This.php
// CHECK: Cannot use `This` as a type name as it is reserved
//// True.php
<?hh
<<file:__EnableUnstableFeatures('case_types')>>
case type True = int;
// CHECK: True.php
// CHECK:A name is expected here
//// Varray.php
<?hh
<<file:__EnableUnstableFeatures('case_types')>>
case type Varray = int;
// CHECK: Varray.php
// CHECK: Cannot use `Varray` as a type name as it is reserved
//// Void.php
<?hh
<<file:__EnableUnstableFeatures('case_types')>>
case type Void = int;
// CHECK: Void.php
// CHECK: A name is expected here
//// _.php
<?hh
<<file:__EnableUnstableFeatures('case_types')>>
case type _ = int;
// CHECK: _.php
// CHECK: Cannot use `_` as a type name as it is reserved |
PHP | hhvm/hphp/hack/test/reserved/enum.php | //// Foo.php
<?hh
// RUN: %hackc compile %s | FileCheck %s
// RUN: { %hh_single_type_check --error-format plain --custom-hhi-path %empty_directory %s 2>&1 || true; } | FileCheck %s
enum Foo : int {}
// CHECK-NOT: .fatal
// CHECK-NOT: File "enum.php--Foo.php"
//// Arraykey.php
<?hh
enum Arraykey : int {}
// CHECK: Arraykey.php
// CHECK: Cannot use `Arraykey` as a type name as it is reserved
//// Bool.php
<?hh
enum Bool : int {}
// CHECK: Bool.php
// CHECK: A name is expected here.
//// Callable.php
<?hh
enum Callable : int {}
// CHECK: Callable.php
// CHECK: Cannot use `Callable` as a type name as it is reserved
//// Classname.php
<?hh
enum Classname : int {}
// CHECK-NOT: .fatal
// CHECK-NOT: File "interface.php--Classname.php"
//// Darray.php
<?hh
enum Darray : int {}
// CHECK: Darray.php
// CHECK: Cannot use `Darray` as a type name as it is reserved
//// Dynamic.php
<?hh
enum Dynamic : int {}
// CHECK: Dynamic.php
// CHECK: Cannot use `Dynamic` as a type name as it is reserved
//// False.php
<?hh
enum False : int {}
// CHECK: False.php
// CHECK: A name is expected here.
//// Float.php
<?hh
enum Float : int {}
// CHECK: Float.php
// CHECK: Cannot use `Float` as a type name as it is reserved
//// Int.php
<?hh
enum Int : int {}
// CHECK: Int.php
// CHECK: A name is expected here.
//// Mixed.php
<?hh
enum Mixed : int {}
// CHECK: Mixed.php
// CHECK: Cannot use `Mixed` as a type name as it is reserved
//// Nonnull.php
<?hh
enum Nonnull : int {}
// CHECK: Nonnull.php
// CHECK: Cannot use `Nonnull` as a type name as it is reserved
//// Noreturn.php
<?hh
enum Noreturn : int {}
// CHECK: Noreturn.php
// CHECK: Cannot use `Noreturn` as a type name as it is reserved
//// Nothing.php
<?hh
enum Nothing : int {}
// CHECK: Nothing.php
// CHECK: Cannot use `Nothing` as a type name as it is reserved
//// Null.php
<?hh
enum Null : int {}
// CHECK: Null.php
// CHECK: A name is expected here.
//// Num.php
<?hh
enum Num : int {}
// CHECK: Num.php
// CHECK: Cannot use `Num` as a type name as it is reserved
//// Parent.php
<?hh
enum Parent : int {}
// CHECK: Parent.php
// CHECK: A name is expected here.
//// Resource.php
<?hh
enum Resource : int {}
// CHECK: Resource.php
// CHECK: Cannot use `Resource` as a type name as it is reserved
//// Self.php
<?hh
enum Self : int {}
// CHECK: Self.php
// CHECK: A name is expected here.
//// Static.php
<?hh
enum Static : int {}
// CHECK: Static.php
// CHECK: A name is expected here.
//// String.php
<?hh
enum String : int {}
// CHECK: String.php
// CHECK: A name is expected here.
//// This.php
<?hh
enum This : int {}
// CHECK: This.php
// CHECK: Cannot use `This` as a type name as it is reserved
//// True.php
<?hh
enum True : int {}
// CHECK: True.php
// CHECK: A name is expected here.
//// Varray.php
<?hh
enum Varray : int {}
// CHECK: Varray.php
// CHECK: Cannot use `Varray` as a type name as it is reserved
//// Void.php
<?hh
enum Void : int {}
// CHECK: Void.php
// CHECK: A name is expected here.
//// _.php
<?hh
enum _ : int {}
// CHECK: _.php
// CHECK: Cannot use `_` as a type name as it is reserved |
PHP | hhvm/hphp/hack/test/reserved/enum_class.php | //// Foo.php
<?hh
// RUN: %hackc compile %s | FileCheck %s
// RUN: { %hh_single_type_check --error-format plain --custom-hhi-path %empty_directory %s 2>&1 || true; } | FileCheck %s
enum class Foo : int {}
// CHECK-NOT: .fatal
// CHECK-NOT: File "enum_class.php--Foo.php"
//// Arraykey.php
<?hh
enum class Arraykey : int {}
// CHECK: Arraykey.php
// CHECK: Cannot use `Arraykey` as a type name as it is reserved
//// Bool.php
<?hh
enum class Bool : int {}
// CHECK: Bool.php
// CHECK: A name is expected here.
//// Callable.php
<?hh
enum class Callable : int {}
// CHECK: Callable.php
// CHECK: Cannot use `Callable` as a type name as it is reserved
//// Classname.php
<?hh
enum class Classname : int {}
// CHECK-NOT: .fatal
// CHECK-NOT: File "interface.php--Classname.php"
//// Darray.php
<?hh
enum class Darray : int {}
// CHECK: Darray.php
// CHECK: Cannot use `Darray` as a type name as it is reserved
//// Dynamic.php
<?hh
enum class Dynamic : int {}
// CHECK: Dynamic.php
// CHECK: Cannot use `Dynamic` as a type name as it is reserved
//// False.php
<?hh
enum class False : int {}
// CHECK: False.php
// CHECK: A name is expected here.
//// Float.php
<?hh
enum class Float : int {}
// CHECK: Float.php
// CHECK: Cannot use `Float` as a type name as it is reserved
//// Int.php
<?hh
enum class Int : int {}
// CHECK: Int.php
// CHECK: A name is expected here.
//// Mixed.php
<?hh
enum class Mixed : int {}
// CHECK: Mixed.php
// CHECK: Cannot use `Mixed` as a type name as it is reserved
//// Nonnull.php
<?hh
enum class Nonnull : int {}
// CHECK: Nonnull.php
// CHECK: Cannot use `Nonnull` as a type name as it is reserved
//// Noreturn.php
<?hh
enum class Noreturn : int {}
// CHECK: Noreturn.php
// CHECK: Cannot use `Noreturn` as a type name as it is reserved
//// Nothing.php
<?hh
enum class Nothing : int {}
// CHECK: Nothing.php
// CHECK: Cannot use `Nothing` as a type name as it is reserved
//// Null.php
<?hh
enum class Null : int {}
// CHECK: Null.php
// CHECK: A name is expected here.
//// Num.php
<?hh
enum class Num : int {}
// CHECK: Num.php
// CHECK: Cannot use `Num` as a type name as it is reserved
//// Parent.php
<?hh
enum class Parent : int {}
// CHECK: Parent.php
// CHECK: A name is expected here.
//// Resource.php
<?hh
enum class Resource : int {}
// CHECK: Resource.php
// CHECK: Cannot use `Resource` as a type name as it is reserved
//// Self.php
<?hh
enum class Self : int {}
// CHECK: Self.php
// CHECK: A name is expected here.
//// Static.php
<?hh
enum class Static : int {}
// CHECK: Static.php
// CHECK: A name is expected here.
//// String.php
<?hh
enum class String : int {}
// CHECK: String.php
// CHECK: A name is expected here.
//// This.php
<?hh
enum class This : int {}
// CHECK: This.php
// CHECK: Cannot use `This` as a type name as it is reserved
//// True.php
<?hh
enum class True : int {}
// CHECK: True.php
// CHECK: A name is expected here.
//// Varray.php
<?hh
enum class Varray : int {}
// CHECK: Varray.php
// CHECK: Cannot use `Varray` as a type name as it is reserved
//// Void.php
<?hh
enum class Void : int {}
// CHECK: Void.php
// CHECK: A name is expected here.
//// _.php
<?hh
enum class _ : int {}
// CHECK: _.php
// CHECK: Cannot use `_` as a type name as it is reserved |
PHP | hhvm/hphp/hack/test/reserved/interface.php | //// Foo.php
<?hh
// RUN: %hackc compile %s | FileCheck %s
// RUN: { %hh_single_type_check --error-format plain --custom-hhi-path %empty_directory %s 2>&1 || true; } | FileCheck %s
interface Foo {}
// CHECK-NOT: .fatal
// CHECK-NOT: File "interface.php--Foo.php"
//// Arraykey.php
<?hh
interface Arraykey {}
// CHECK: Arraykey.php
// CHECK: Cannot use `Arraykey` as a type name as it is reserved
//// Bool.php
<?hh
interface Bool {}
// CHECK: Bool.php
// CHECK: Cannot use `Bool` as a type name as it is reserved
//// Callable.php
<?hh
interface Callable {}
// CHECK: Callable.php
// CHECK: Cannot use `Callable` as a type name as it is reserved
//// Classname.php
<?hh
interface Classname {}
// CHECK-NOT: .fatal
// CHECK-NOT: File "interface.php--Classname.php"
//// Darray.php
<?hh
interface Darray {}
// CHECK: Darray.php
// CHECK: Cannot use `Darray` as a type name as it is reserved
//// Dynamic.php
<?hh
interface Dynamic {}
// CHECK: Dynamic.php
// CHECK: Cannot use `Dynamic` as a type name as it is reserved
//// False.php
<?hh
interface False {}
// CHECK: False.php
// CHECK: Cannot use `False` as a type name as it is reserved
//// Float.php
<?hh
interface Float {}
// CHECK: Float.php
// CHECK: Cannot use `Float` as a type name as it is reserved
//// Int.php
<?hh
interface Int {}
// CHECK: Int.php
// CHECK: Cannot use `Int` as a type name as it is reserved
//// Mixed.php
<?hh
interface Mixed {}
// CHECK: Mixed.php
// CHECK: Cannot use `Mixed` as a type name as it is reserved
//// Nonnull.php
<?hh
interface Nonnull {}
// CHECK: Nonnull.php
// CHECK: Cannot use `Nonnull` as a type name as it is reserved
//// Noreturn.php
<?hh
interface Noreturn {}
// CHECK: Noreturn.php
// CHECK: Cannot use `Noreturn` as a type name as it is reserved
//// Nothing.php
<?hh
interface Nothing {}
// CHECK: Nothing.php
// CHECK: Cannot use `Nothing` as a type name as it is reserved
//// Null.php
<?hh
interface Null {}
// CHECK: Null.php
// CHECK: Cannot use `Null` as a type name as it is reserved
//// Num.php
<?hh
interface Num {}
// CHECK: Num.php
// CHECK: Cannot use `Num` as a type name as it is reserved
//// Parent.php
<?hh
interface Parent {}
// CHECK: Parent.php
// CHECK: Cannot use `Parent` as a type name as it is reserved
//// Resource.php
<?hh
interface Resource {}
// CHECK: Resource.php
// CHECK: Cannot use `Resource` as a type name as it is reserved
//// Self.php
<?hh
interface Self {}
// CHECK: Self.php
// CHECK: Cannot use `Self` as a type name as it is reserved
//// Static.php
<?hh
interface Static {}
// CHECK: Static.php
// CHECK: A name is expected here
//// String.php
<?hh
interface String {}
// CHECK: String.php
// CHECK: Cannot use `String` as a type name as it is reserved
//// This.php
<?hh
interface This {}
// CHECK: This.php
// CHECK: Cannot use `This` as a type name as it is reserved
//// True.php
<?hh
interface True {}
// CHECK: True.php
// CHECK: Cannot use `True` as a type name as it is reserved
//// Varray.php
<?hh
interface Varray {}
// CHECK: Varray.php
// CHECK: Cannot use `Varray` as a type name as it is reserved
//// Void.php
<?hh
interface Void {}
// CHECK: Void.php
// CHECK: Cannot use `Void` as a type name as it is reserved
//// _.php
<?hh
interface _ {}
// CHECK: _.php
// CHECK: Cannot use `_` as a type name as it is reserved |
PHP | hhvm/hphp/hack/test/reserved/module_newtype.php | //// mm.php
<?hh
// RUN: %hackc compile %s | FileCheck %s
// RUN: { %hh_single_type_check --error-format plain --custom-hhi-path %empty_directory %s 2>&1 || true; } | FileCheck %s
new module mm {}
//// Foo.php
<?hh
module mm;
module newtype Foo as int = int;
// CHECK-NOT: .fatal
// CHECK-NOT: File "module_newtype.php--Foo.php"
//// Arraykey.php
<?hh
module mm;
module newtype Arraykey as int = int;
// CHECK: Arraykey.php
// CHECK: Cannot use `Arraykey` as a type name as it is reserved
//// Bool.php
<?hh
module mm;
module newtype Bool as int = int;
// CHECK: Bool.php
// CHECK: Cannot use `Bool` as a type name as it is reserved
//// Callable.php
<?hh
module mm;
module newtype Callable as int = int;
// CHECK: Callable.php
// CHECK: Cannot use `Callable` as a type name as it is reserved
//// Classname.php
<?hh
module mm;
module newtype Classname as int = int;
// CHECK-NOT: .fatal
// CHECK-NOT: File "type.php--Classname.php"
//// Darray.php
<?hh
module mm;
module newtype Darray as int = int;
// CHECK: Darray.php
// CHECK: Cannot use `Darray` as a type name as it is reserved
//// Dynamic.php
<?hh
module mm;
module newtype Dynamic as int = int;
// CHECK: Dynamic.php
// CHECK: Cannot use `Dynamic` as a type name as it is reserved
//// False.php
<?hh
module mm;
module newtype False as int = int;
// CHECK: False.php
// CHECK: Cannot use `False` as a type name as it is reserved
//// Float.php
<?hh
module mm;
module newtype Float as int = int;
// CHECK: Float.php
// CHECK: Cannot use `Float` as a type name as it is reserved
//// Int.php
<?hh
module mm;
module newtype Int as int = int;
// CHECK: Int.php
// CHECK: Cannot use `Int` as a type name as it is reserved
//// Mixed.php
<?hh
module mm;
module newtype Mixed as int = int;
// CHECK: Mixed.php
// CHECK: Cannot use `Mixed` as a type name as it is reserved
//// Nonnull.php
<?hh
module mm;
module newtype Nonnull as int = int;
// CHECK: Nonnull.php
// CHECK: Cannot use `Nonnull` as a type name as it is reserved
//// Noreturn.php
<?hh
module mm;
module newtype Noreturn as int = int;
// CHECK: Noreturn.php
// CHECK: Cannot use `Noreturn` as a type name as it is reserved
//// Nothing.php
<?hh
module mm;
module newtype Nothing as int = int;
// CHECK: Nothing.php
// CHECK: Cannot use `Nothing` as a type name as it is reserved
//// Null.php
<?hh
module mm;
module newtype Null as int = int;
// CHECK: Null.php
// CHECK: Cannot use `Null` as a type name as it is reserved
//// Num.php
<?hh
module mm;
module newtype Num as int = int;
// CHECK: Num.php
// CHECK: Cannot use `Num` as a type name as it is reserved
//// Parent.php
<?hh
module mm;
module newtype Parent as int = int;
// CHECK: Parent.php
// CHECK: Cannot use `Parent` as a type name as it is reserved
//// Resource.php
<?hh
module mm;
module newtype Resource as int = int;
// CHECK: Resource.php
// CHECK: Cannot use `Resource` as a type name as it is reserved
//// Self.php
<?hh
module mm;
module newtype Self as int = int;
// CHECK: Self.php
// CHECK: Cannot use `Self` as a type name as it is reserved
//// Static.php
<?hh
module mm;
module newtype Static as int = int;
// CHECK: Static.php
// CHECK: A name is expected here
//// String.php
<?hh
module mm;
module newtype String as int = int;
// CHECK: String.php
// CHECK: Cannot use `String` as a type name as it is reserved
//// This.php
<?hh
module mm;
module newtype This as int = int;
// CHECK: This.php
// CHECK: Cannot use `This` as a type name as it is reserved
//// True.php
<?hh
module mm;
module newtype True as int = int;
// CHECK: True.php
// CHECK: Cannot use `True` as a type name as it is reserved
//// Varray.php
<?hh
module mm;
module newtype Varray as int = int;
// CHECK: Varray.php
// CHECK: Cannot use `Varray` as a type name as it is reserved
//// Void.php
<?hh
module mm;
module newtype Void as int = int;
// CHECK: Void.php
// CHECK: Cannot use `Void` as a type name as it is reserved
//// _.php
<?hh
module mm;
module newtype _ as int = int;
// CHECK: _.php
// CHECK: Cannot use `_` as a type name as it is reserved |
PHP | hhvm/hphp/hack/test/reserved/newctx.php | //// defaults.php
<?hh
// RUN: %hackc compile %s | FileCheck %s
// RUN: { %hh_single_type_check --error-format plain --custom-hhi-path %empty_directory %s 2>&1 || true; } | FileCheck %s
namespace HH\Contexts {
type defaults = (I);
interface I {}
}
//// Foo.php
<?hh
<<file:__EnableUnstableFeatures('context_alias_declaration_short')>>
newctx Foo as [defaults];
// CHECK-NOT: .fatal
// CHECK-NOT: File "newctx.php--Foo.php"
//// Arraykey.php
<?hh
<<file:__EnableUnstableFeatures('context_alias_declaration_short')>>
newctx Arraykey as [defaults];
// CHECK: Arraykey.php
// CHECK: Cannot use `Arraykey` as a type name as it is reserved
//// Bool.php
<?hh
<<file:__EnableUnstableFeatures('context_alias_declaration_short')>>
newctx Bool as [defaults];
// CHECK: Bool.php
// CHECK: A name is expected here
//// Callable.php
<?hh
<<file:__EnableUnstableFeatures('context_alias_declaration_short')>>
newctx Callable as [defaults];
// CHECK: Callable.php
// CHECK: Cannot use `Callable` as a type name as it is reserved
//// Classname.php
<?hh
<<file:__EnableUnstableFeatures('context_alias_declaration_short')>>
newctx Classname as [defaults];
// CHECK-NOT: .fatal
// CHECK-NOT: File "type.php--Classname.php"
//// Darray.php
<?hh
<<file:__EnableUnstableFeatures('context_alias_declaration_short')>>
newctx Darray as [defaults];
// CHECK: Darray.php
// CHECK: Cannot use `Darray` as a type name as it is reserved
//// Dynamic.php
<?hh
<<file:__EnableUnstableFeatures('context_alias_declaration_short')>>
newctx Dynamic as [defaults];
// CHECK: Dynamic.php
// CHECK: Cannot use `Dynamic` as a type name as it is reserved
//// False.php
<?hh
<<file:__EnableUnstableFeatures('context_alias_declaration_short')>>
newctx False as [defaults];
// CHECK: False.php
// CHECK: A name is expected here
//// Float.php
<?hh
<<file:__EnableUnstableFeatures('context_alias_declaration_short')>>
newctx Float as [defaults];
// CHECK: Float.php
// CHECK: Cannot use `Float` as a type name as it is reserved
//// Int.php
<?hh
<<file:__EnableUnstableFeatures('context_alias_declaration_short')>>
newctx Int as [defaults];
// CHECK: Int.php
// CHECK: A name is expected here
//// Mixed.php
<?hh
<<file:__EnableUnstableFeatures('context_alias_declaration_short')>>
newctx Mixed as [defaults];
// CHECK: Mixed.php
// CHECK: Cannot use `Mixed` as a type name as it is reserved
//// Nonnull.php
<?hh
<<file:__EnableUnstableFeatures('context_alias_declaration_short')>>
newctx Nonnull as [defaults];
// CHECK: Nonnull.php
// CHECK: Cannot use `Nonnull` as a type name as it is reserved
//// Noreturn.php
<?hh
<<file:__EnableUnstableFeatures('context_alias_declaration_short')>>
newctx Noreturn as [defaults];
// CHECK: Noreturn.php
// CHECK: Cannot use `Noreturn` as a type name as it is reserved
//// Nothing.php
<?hh
<<file:__EnableUnstableFeatures('context_alias_declaration_short')>>
newctx Nothing as [defaults];
// CHECK: Nothing.php
// CHECK: Cannot use `Nothing` as a type name as it is reserved
//// Null.php
<?hh
<<file:__EnableUnstableFeatures('context_alias_declaration_short')>>
newctx Null as [defaults];
// CHECK: Null.php
// CHECK: A name is expected here
//// Num.php
<?hh
<<file:__EnableUnstableFeatures('context_alias_declaration_short')>>
newctx Num as [defaults];
// CHECK: Num.php
// CHECK: Cannot use `Num` as a type name as it is reserved
//// Parent.php
<?hh
<<file:__EnableUnstableFeatures('context_alias_declaration_short')>>
newctx Parent as [defaults];
// CHECK: Parent.php
// CHECK: A name is expected here
//// Resource.php
<?hh
<<file:__EnableUnstableFeatures('context_alias_declaration_short')>>
newctx Resource as [defaults];
// CHECK: Resource.php
// CHECK: Cannot use `Resource` as a type name as it is reserved
//// Self.php
<?hh
<<file:__EnableUnstableFeatures('context_alias_declaration_short')>>
newctx Self as [defaults];
// CHECK: Self.php
// CHECK: A name is expected here
//// Static.php
<?hh
<<file:__EnableUnstableFeatures('context_alias_declaration_short')>>
newctx Static as [defaults];
// CHECK: Static.php
// CHECK: A name is expected here
//// String.php
<?hh
<<file:__EnableUnstableFeatures('context_alias_declaration_short')>>
newctx String as [defaults];
// CHECK: String.php
// CHECK: A name is expected here
//// This.php
<?hh
<<file:__EnableUnstableFeatures('context_alias_declaration_short')>>
newctx This as [defaults];
// CHECK: This.php
// CHECK: Cannot use `This` as a type name as it is reserved
//// True.php
<?hh
<<file:__EnableUnstableFeatures('context_alias_declaration_short')>>
newctx True as [defaults];
// CHECK: True.php
// CHECK: A name is expected here
//// Varray.php
<?hh
<<file:__EnableUnstableFeatures('context_alias_declaration_short')>>
newctx Varray as [defaults];
// CHECK: Varray.php
// CHECK: Cannot use `Varray` as a type name as it is reserved
//// Void.php
<?hh
<<file:__EnableUnstableFeatures('context_alias_declaration_short')>>
newctx Void as [defaults];
// CHECK: Void.php
// CHECK: A name is expected here
//// _.php
<?hh
<<file:__EnableUnstableFeatures('context_alias_declaration_short')>>
newctx _ as [defaults];
// CHECK: _.php
// CHECK: Cannot use `_` as a type name as it is reserved |
PHP | hhvm/hphp/hack/test/reserved/newtype.php | //// Foo.php
<?hh
// RUN: %hackc compile %s | FileCheck %s
// RUN: { %hh_single_type_check --error-format plain --custom-hhi-path %empty_directory %s 2>&1 || true; } | FileCheck %s
newtype Foo = int;
// CHECK-NOT: .fatal
// CHECK-NOT: File "newtype.php--Foo.php"
//// Arraykey.php
<?hh
newtype Arraykey = int;
// CHECK: Arraykey.php
// CHECK: Cannot use `Arraykey` as a type name as it is reserved
//// Bool.php
<?hh
newtype Bool = int;
// CHECK: Bool.php
// CHECK: A semicolon `;` is expected here
//// Callable.php
<?hh
newtype Callable = int;
// CHECK: Callable.php
// CHECK: Cannot use `Callable` as a type name as it is reserved
//// Classname.php
<?hh
newtype Classname = int;
// CHECK-NOT: .fatal
// CHECK-NOT: File "type.php--Classname.php"
//// Darray.php
<?hh
newtype Darray = int;
// CHECK: Darray.php
// CHECK: Cannot use `Darray` as a type name as it is reserved
//// Dynamic.php
<?hh
newtype Dynamic = int;
// CHECK: Dynamic.php
// CHECK: Cannot use `Dynamic` as a type name as it is reserved
//// False.php
<?hh
newtype False = int;
// CHECK: False.php
// CHECK: A semicolon `;` is expected here
//// Float.php
<?hh
newtype Float = int;
// CHECK: Float.php
// CHECK: Cannot use `Float` as a type name as it is reserved
//// Int.php
<?hh
newtype Int = int;
// CHECK: Int.php
// CHECK: A semicolon `;` is expected here
//// Mixed.php
<?hh
newtype Mixed = int;
// CHECK: Mixed.php
// CHECK: Cannot use `Mixed` as a type name as it is reserved
//// Nonnull.php
<?hh
newtype Nonnull = int;
// CHECK: Nonnull.php
// CHECK: Cannot use `Nonnull` as a type name as it is reserved
//// Noreturn.php
<?hh
newtype Noreturn = int;
// CHECK: Noreturn.php
// CHECK: Cannot use `Noreturn` as a type name as it is reserved
//// Nothing.php
<?hh
newtype Nothing = int;
// CHECK: Nothing.php
// CHECK: Cannot use `Nothing` as a type name as it is reserved
//// Null.php
<?hh
newtype Null = int;
// CHECK: Null.php
// CHECK: A semicolon `;` is expected here
//// Num.php
<?hh
newtype Num = int;
// CHECK: Num.php
// CHECK: Cannot use `Num` as a type name as it is reserved
//// Parent.php
<?hh
newtype Parent = int;
// CHECK: Parent.php
// CHECK: A semicolon `;` is expected here
//// Resource.php
<?hh
newtype Resource = int;
// CHECK: Resource.php
// CHECK: Cannot use `Resource` as a type name as it is reserved
//// Self.php
<?hh
newtype Self = int;
// CHECK: Self.php
// CHECK: A semicolon `;` is expected here
//// Static.php
<?hh
newtype Static = int;
// CHECK: Static.php
// CHECK: A semicolon `;` is expected here
//// String.php
<?hh
newtype String = int;
// CHECK: String.php
// CHECK: A semicolon `;` is expected here
//// This.php
<?hh
newtype This = int;
// CHECK: This.php
// CHECK: Cannot use `This` as a type name as it is reserved
//// True.php
<?hh
newtype True = int;
// CHECK: True.php
// CHECK: A semicolon `;` is expected here
//// Varray.php
<?hh
newtype Varray = int;
// CHECK: Varray.php
// CHECK: Cannot use `Varray` as a type name as it is reserved
//// Void.php
<?hh
newtype Void = int;
// CHECK: Void.php
// CHECK: A semicolon `;` is expected here
//// _.php
<?hh
newtype _ = int;
// CHECK: _.php
// CHECK: Cannot use `_` as a type name as it is reserved |
PHP | hhvm/hphp/hack/test/reserved/type.php | //// Foo.php
<?hh
// RUN: %hackc compile %s | FileCheck %s
// RUN: { %hh_single_type_check --error-format plain --custom-hhi-path %empty_directory %s 2>&1 || true; } | FileCheck %s
type Foo = int;
// CHECK-NOT: .fatal
// CHECK-NOT: File "type.php--Foo.php"
//// Arraykey.php
<?hh
type Arraykey = int;
// CHECK: Arraykey.php
// CHECK: Cannot use `Arraykey` as a type name as it is reserved
//// Bool.php
<?hh
type Bool = int;
// CHECK: Bool.php
// CHECK: A semicolon `;` is expected here
//// Callable.php
<?hh
type Callable = int;
// CHECK: Callable.php
// CHECK: Cannot use `Callable` as a type name as it is reserved
//// Classname.php
<?hh
type Classname = int;
// CHECK-NOT: .fatal
// CHECK-NOT: File "type.php--Classname.php"
//// Darray.php
<?hh
type Darray = int;
// CHECK: Darray.php
// CHECK: Cannot use `Darray` as a type name as it is reserved
//// Dynamic.php
<?hh
type Dynamic = int;
// CHECK: Dynamic.php
// CHECK: Cannot use `Dynamic` as a type name as it is reserved
//// False.php
<?hh
type False = int;
// CHECK: False.php
// CHECK: A semicolon `;` is expected here
//// Float.php
<?hh
type Float = int;
// CHECK: Float.php
// CHECK: Cannot use `Float` as a type name as it is reserved
//// Int.php
<?hh
type Int = int;
// CHECK: Int.php
// CHECK: A semicolon `;` is expected here
//// Mixed.php
<?hh
type Mixed = int;
// CHECK: Mixed.php
// CHECK: Cannot use `Mixed` as a type name as it is reserved
//// Nonnull.php
<?hh
type Nonnull = int;
// CHECK: Nonnull.php
// CHECK: Cannot use `Nonnull` as a type name as it is reserved
//// Noreturn.php
<?hh
type Noreturn = int;
// CHECK: Noreturn.php
// CHECK: Cannot use `Noreturn` as a type name as it is reserved
//// Nothing.php
<?hh
type Nothing = int;
// CHECK: Nothing.php
// CHECK: Cannot use `Nothing` as a type name as it is reserved
//// Null.php
<?hh
type Null = int;
// CHECK: Null.php
// CHECK: A semicolon `;` is expected here
//// Num.php
<?hh
type Num = int;
// CHECK: Num.php
// CHECK: Cannot use `Num` as a type name as it is reserved
//// Parent.php
<?hh
type Parent = int;
// CHECK: Parent.php
// CHECK: A semicolon `;` is expected here
//// Resource.php
<?hh
type Resource = int;
// CHECK: Resource.php
// CHECK: Cannot use `Resource` as a type name as it is reserved
//// Self.php
<?hh
type Self = int;
// CHECK: Self.php
// CHECK: A semicolon `;` is expected here
//// Static.php
<?hh
type Static = int;
// CHECK: Static.php
// CHECK: A semicolon `;` is expected here
//// String.php
<?hh
type String = int;
// CHECK: String.php
// CHECK: A semicolon `;` is expected here
//// This.php
<?hh
type This = int;
// CHECK: This.php
// CHECK: Cannot use `This` as a type name as it is reserved
//// True.php
<?hh
type True = int;
// CHECK: True.php
// CHECK: A semicolon `;` is expected here
//// Varray.php
<?hh
type Varray = int;
// CHECK: Varray.php
// CHECK: Cannot use `Varray` as a type name as it is reserved
//// Void.php
<?hh
type Void = int;
// CHECK: Void.php
// CHECK: A semicolon `;` is expected here
//// _.php
<?hh
type _ = int;
// CHECK: _.php
// CHECK: Cannot use `_` as a type name as it is reserved |
Rust | hhvm/hphp/hack/test/rust_to_ocaml/attrs.rs | /// type X
#[rust_to_ocaml(attr = "deriving show")]
pub type X = A;
/// type Y
#[rust_to_ocaml(
prefix = "y_",
attr = r#"deriving visitors {
variety = "iter";
ancestors = ["iter_ab"];
}"#
)]
pub struct Y {
/// foo
#[rust_to_ocaml(attr = "opaque")]
#[rust_to_ocaml(attr = "visitors.opaque")]
pub foo: A,
/// bar
pub bar: B,
}
/// type Visibility
#[rust_to_ocaml(prefix = "V", attr = "deriving eq, ord, show { with_path = false }")]
enum Visibility {
/// Private
#[rust_to_ocaml(attr = "visitors.name \"visibility_VPrivate\"")]
Private,
/// Public
#[rust_to_ocaml(attr = r#"visitors.name "visibility_VPublic""#)]
Public,
} |
TOML | hhvm/hphp/hack/test/rust_to_ocaml/config.toml | [modules]
rename = [
["i_map", "IMap"],
["i_set", "ISet"],
["s_map", "SMap"],
["s_set", "SSet"],
]
[types]
transparent = [
"Box", "std::boxed::Box",
"Rc", "std::rc::Rc",
"Arc", "std::sync::Arc",
"RcOc", "ocamlrep::rc::RcOc",
]
rename = [
["Vec", "list"],
["std::vec::Vec", "list"],
] |
Rust | hhvm/hphp/hack/test/rust_to_ocaml/doc_comment.rs | /// Type A
pub type A = X;
/// Type B
/// is int
pub type B = X;
/// Type C has a fenced code block:
///
/// ```
/// function f(): int {
/// return 0;
/// }
/// ```
///
/// And an unfenced code block:
///
/// function g(): int {
/// return 0;
/// }
///
/// It should stay indented.
pub type C = X;
/** Type D has a multiline delimited comment:
```
function f(): int {
return 0;
}
```
And an indented code block:
```
function g(): int {
return 0;
}
```
*/
pub type D = X;
/// Records can have comments on the fields.
pub struct Record {
/// The comments come after the field declaration in OCaml.
pub foo: X,
/// bar comment
pub bar: X,
}
/// Variant types can have comments on each variant.
pub enum Variant {
/// Again, the comments come after the variant declaration.
/// Multiline comments are understood.
Foo,
/** Bar has a multiline delimited comment, even though it's
unusual in Rust source. */
Bar,
/// Baz comment
Baz { a: X, b: X },
/// Qux is a struct-like variant with a long comment spanning
/// multiple lines.
#[rust_to_ocaml(prefix = "q_")]
Qux { a: X, b: X },
} |
Rust | hhvm/hphp/hack/test/rust_to_ocaml/inline_tuple.rs | pub enum E {
Foo((A, B)),
Bar(Box<(A, B)>),
#[rust_to_ocaml(inline_tuple)]
Baz((A, B)),
#[rust_to_ocaml(inline_tuple)]
Qux(Box<(A, B)>),
} |
Rust | hhvm/hphp/hack/test/rust_to_ocaml/int.rs | pub type A = i8;
pub type B = u8;
pub type C = i16;
pub type D = u16;
pub type E = i32;
pub type F = u32;
pub type G = i64;
pub type H = u64;
pub type I = i128;
pub type J = u128;
pub type K = isize;
pub type L = usize; |
Rust | hhvm/hphp/hack/test/rust_to_ocaml/keywords.rs | pub struct Foo {
and: A,
assert: A,
asr: A,
begin: A,
class: A,
constraint: A,
done: A,
downto: A,
end: A,
exception: A,
external: A,
fun: A,
function: A,
functor: A,
include: A,
inherit: A,
initializer: A,
land: A,
lazy: A,
lor: A,
lsl: A,
lsr: A,
lxor: A,
method: A,
module: A,
mutable: A,
new: A,
nonrec: A,
object: A,
of: A,
open: A,
or: A,
private: A,
rec: A,
sig: A,
then: A,
to: A,
val: A,
when: A,
with: A,
}
type A = And;
type A = As;
type A = Assert;
type A = Asr;
type A = Begin;
type A = Class;
type A = Constraint;
type A = Do;
type A = Done;
type A = Downto;
type A = Else;
type A = End;
type A = Exception;
type A = External;
type A = False;
type A = For;
type A = Fun;
type A = Function;
type A = Functor;
type A = If;
type A = In;
type A = Include;
type A = Inherit;
type A = Initializer;
type A = Land;
type A = Lazy;
type A = Let;
type A = Lor;
type A = Lsl;
type A = Lsr;
type A = Lxor;
type A = Match;
type A = Method;
type A = Mod;
type A = Module;
type A = Mutable;
type A = New;
type A = Nonrec;
type A = Object;
type A = Of;
type A = Open;
type A = Or;
type A = Private;
type A = Rec;
type A = Sig;
type A = Struct;
type A = Then;
type A = To;
type A = True;
type A = Try;
type A = Type;
type A = Val;
type A = Virtual;
type A = When;
type A = While;
type A = With; |
Rust | hhvm/hphp/hack/test/rust_to_ocaml/lists.rs | pub type MyVec = Vec<X>;
pub type BoxedSlice = Box<[X]>;
pub type Slice<'a> = &'a [X];
pub type StdVec = std::vec::Vec<X>;
pub type StdBoxedSlice = std::boxed::Box<[X]>; |
Rust | hhvm/hphp/hack/test/rust_to_ocaml/mutual_rec.rs | pub struct Foo(pub Bar, pub Bar);
#[rust_to_ocaml(and)]
pub struct Bar(pub Option<Foo>, pub Option<Foo>); |
Rust | hhvm/hphp/hack/test/rust_to_ocaml/name_attribute.rs | #[rust_to_ocaml(name = "aa")] // ignored
type A = X;
#[rust_to_ocaml(name = "bb")] // ignored
struct B {
#[rust_to_ocaml(name = "bb_x")]
foo: x,
#[rust_to_ocaml(name = "bb_y")]
bar: y,
}
#[rust_to_ocaml(name = "cc")] // ignored
#[rust_to_ocaml(prefix = "C")]
enum C {
#[rust_to_ocaml(name = "C_foo")]
Foo,
#[rust_to_ocaml(name = "Bar")]
Bar {
#[rust_to_ocaml(name = "bar_x")]
foo: x,
#[rust_to_ocaml(name = "bar_y")]
bar: y,
},
Baz,
}
type a_alias = a;
type b_alias = b;
type c_alias = c; |
Rust | hhvm/hphp/hack/test/rust_to_ocaml/pointers.rs | pub type BoxA = Box<A>;
pub type RcA = Rc<A>;
pub type ArcA = Arc<A>;
pub type RcOcA = Arc<A>;
pub type StdBoxA = std::boxed::Box<A>;
pub type StdRcA = std::rc::Rc<A>;
pub type StdArcA = std::sync::Arc<A>;
pub type OcamlrepRcOcA = std::sync::Arc<A>;
pub type BoxedTuple = Box<(Box<A>, Box<B>)>; |
Rust | hhvm/hphp/hack/test/rust_to_ocaml/qualified_name.rs | pub type A = x::Foo;
pub type B = y::z::Foo;
pub type C = my_module::some_submodule::Foo;
pub type D = i_map::IMap<X>; |
Rust | hhvm/hphp/hack/test/rust_to_ocaml/struct.rs | pub struct MyStruct {
pub foo: isize,
pub bar: isize,
}
#[rust_to_ocaml(prefix = "a_")]
pub struct StructA {
pub foo: isize,
pub bar: isize,
}
#[rust_to_ocaml(prefix = "b_")]
pub struct StructB {
pub foo: isize,
pub bar: isize,
} |
Rust | hhvm/hphp/hack/test/rust_to_ocaml/tuple.rs | // Copyright (c) Meta Platforms, Inc. and affiliates.
//
// This source code is licensed under the MIT license found in the
// LICENSE file in the "hack" directory of this source tree.
type TupleA = (A, B);
type TupleB = (A, (B, C)); |
Rust | hhvm/hphp/hack/test/rust_to_ocaml/tuple_structs.rs | pub struct A;
pub struct B();
pub struct C(());
pub struct D(pub X);
pub struct E(pub Y, pub Z); |
Rust | hhvm/hphp/hack/test/rust_to_ocaml/type_name_matches_module_name.rs | pub type A = pos::Pos;
pub type B = crate::relative_path::RelativePath;
pub type C = collections::s_set::SSet;
pub type TypeNameMatchesModuleName = D;
pub mod foo {
pub type Foo = E;
pub type Maybe = Option<Foo>;
} |
Rust | hhvm/hphp/hack/test/rust_to_ocaml/variants.rs | pub enum A {
I,
J(isize),
K(isize, isize),
L((isize, isize)),
M { x: isize, y: isize },
}
#[rust_to_ocaml(prefix = "P")]
pub enum Prefixed {
I,
J(isize),
K(isize, isize),
L((isize, isize)),
#[rust_to_ocaml(prefix = "m_")]
M {
x: isize,
y: isize,
},
} |
PHP | hhvm/hphp/hack/test/sdt_analysis/codemod/add_nad1.php | <?hh
class TheParent {}
// comment
<<__ConsistentConstruct>>
final class A {}
final class B {}
/**/ final
/**/ class
/**/ C
/**/ extends TheParent {} final class D {} // |
hhvm/hphp/hack/test/sdt_analysis/codemod/dune | (rule
(alias sdt_analysis_codemod)
(deps
%{exe:../../../src/hh_single_type_check.exe}
%{project_root}/hack/test/verify.py
%{project_root}/hack/test/review.sh
%{project_root}/hack/test/sdt_analysis/codemod/HH_FLAGS
(glob_files %{project_root}/hack/test/sdt_analysis/codemod/*.php)
(glob_files %{project_root}/hack/test/sdt_analysis/codemod/*.php.exp))
(action
(run
%{project_root}/hack/test/verify.py
%{project_root}/hack/test/sdt_analysis/codemod
--program
%{exe:../../../src/hh_single_type_check.exe}
--in-extension
.php
--flags
--sdt-analysis
codemod
--error-format
plain)))
(alias
(name runtest)
(deps
(alias sdt_analysis_codemod))) |
|
hhvm/hphp/hack/test/sdt_analysis/dump/dune | (rule
(alias sdt_analysis_dump)
(deps
%{exe:../../../src/hh_single_type_check.exe}
%{project_root}/hack/test/verify.py
%{project_root}/hack/test/review.sh
%{project_root}/hack/test/sdt_analysis/hhi/sdt_analysis_test.hhi
%{project_root}/hack/test/sdt_analysis/dump/HH_FLAGS
(glob_files %{project_root}/hack/test/sdt_analysis/dump/*.php)
(glob_files %{project_root}/hack/test/sdt_analysis/dump/*.php.exp))
(action
(run
%{project_root}/hack/test/verify.py
%{project_root}/hack/test/sdt_analysis/dump
--program
%{exe:../../../src/hh_single_type_check.exe}
--in-extension
.php
--flags
--sdt-analysis
dump
--error-format
plain)))
(alias
(name runtest)
(deps
(alias sdt_analysis_dump))) |
|
PHP | hhvm/hphp/hack/test/sdt_analysis/dump/dynamic_call_to_function_double.php | <?hh
function f(string $s): void {}
function main1(dynamic $d): void {
f($d); // f NeedsSDT
}
function main2(dynamic $d): void {
f($d); // f NeedsSDT
} |
PHP | hhvm/hphp/hack/test/sdt_analysis/dump/dynamic_call_to_function_double2.php | <?hh
function f(string $s): void {}
function main1(dynamic $d): void {
f($d); // f NeedsSDT
}
function main2(string $d): void {
f($d);
} |
PHP | hhvm/hphp/hack/test/sdt_analysis/dump/dynamic_call_to_function_double3.php | <?hh
function f(string $s): void {}
function main1(string $d): void {
f($d);
}
function main2(dynamic $d): void {
f($d); // f NeedsSDT
} |
PHP | hhvm/hphp/hack/test/sdt_analysis/dump/dynamic_instance_method_call.php | <?hh
class C {
public function m(string $s): void {}
}
function main(C $c, dynamic $d): void {
$c->m($d);
} |
PHP | hhvm/hphp/hack/test/sdt_analysis/dump/dynamic_static_method_call.php | <?hh
class C {
public static function m(string $s): void {}
}
function main(dynamic $d): void {
C::m($d);
} |
PHP | hhvm/hphp/hack/test/sdt_analysis/dump/extends1.php | <?hh
class NadMe1 {}
class NadMe2 extends NadMe1 {}
class NadMe3 extends NadMe2 {}
class SdMe1 {
public static function foo(vec<int> $_): void {}
}
class SdMe2 extends SdMe1 {}
final class SdMe3 extends SdMe2 {}
function main(dynamic $d): void {
SdMe1::foo($d);
} |
PHP | hhvm/hphp/hack/test/sdt_analysis/dump/is_syntactically_nadable.php | <?hh
class Yes1 {}
abstract class Yes2 {}
interface Yes3 {}
trait Yes4 {}
enum No1 : int {}
enum class No2 : int {}
function yes_fn(): void {} |
PHP | hhvm/hphp/hack/test/sdt_analysis/dump/normal_call_to_function_under_dynamic.php | <?hh
class C<T> {}
function f(C<int> $_): void {}
function main(C<int> $c): void {
f($c); // f NeedsSDT
} |
PHP | hhvm/hphp/hack/test/sdt_analysis/dump/normal_instance_method_call.php | <?hh
class C {
public function m(string $s): void {}
}
function main(C $c): void {
$c->m("hello");
} |
PHP | hhvm/hphp/hack/test/sdt_analysis/dump/normal_static_method_call.php | <?hh
class C {
public static function m(string $s): void {}
}
function main(): void {
C::m("hello");
} |
PHP | hhvm/hphp/hack/test/sdt_analysis/dump/param_with_default.php | <?hh
function f(
string $_,
string $default = "how do you like them apples"
): void {}
function main(dynamic $dyn): void {
f($dyn);
} |
PHP | hhvm/hphp/hack/test/sdt_analysis/dump/signature_formation4.php | <?hh
// This function doesn't have to be SDT but the current conservative check
// thinks it is.
function f<T>(T $t): T { return $t; } |
PHP | hhvm/hphp/hack/test/sdt_analysis/dump/signature_formation7.php | <?hh
class C<T> {}
function needs_sdt<T>(C<T> $_): void {}
function doesnt_need_sdt<T as arraykey>(C<T> $_): void {} |
HTML Help Workshop | hhvm/hphp/hack/test/sdt_analysis/hhi/sdt_analysis_test.hhi | <?hh
class ClassFromHhi1 {
public static function meth(vec<int> $_): void {}
}
class ClassFromHhi2 {
public static function meth(vec<int> $_): void {}
} |
hhvm/hphp/hack/test/sdt_analysis/solve/dune | (rule
(alias sdt_analysis_solve)
(deps
%{exe:../../../src/hh_single_type_check.exe}
%{project_root}/hack/test/verify.py
%{project_root}/hack/test/review.sh
%{project_root}/hack/test/sdt_analysis/hhi/sdt_analysis_test.hhi
%{project_root}/hack/test/sdt_analysis/solve/HH_FLAGS
(glob_files %{project_root}/hack/test/sdt_analysis/solve/*.php)
(glob_files %{project_root}/hack/test/sdt_analysis/solve/*.php.exp))
(action
(run
%{project_root}/hack/test/verify.py
%{project_root}/hack/test/sdt_analysis/solve
--program
%{exe:../../../src/hh_single_type_check.exe}
--in-extension
.php
--flags
--sdt-analysis
solve
--error-format
plain)))
(alias
(name runtest)
(deps
(alias sdt_analysis_solve))) |
|
PHP | hhvm/hphp/hack/test/sdt_analysis/solve/extends1.php | <?hh
class NadMe1 {}
class NadMe2 extends NadMe1 {}
class NadMe3 extends NadMe2 {}
class SdMe1 { // NeedsSDT
public static function foo(vec<int> $_): void {}
}
class SdMe2 extends SdMe1 {} // NeedsSDT
final class SdMe3 extends SdMe2 {} // NeedsSDT
function main(dynamic $d): void {
SdMe1::foo($d);
} |
PHP | hhvm/hphp/hack/test/sdt_analysis/solve/implements1.php | <?hh
interface I {
public function foo(vec<int> $_): void;
}
final class C implements I {
public function foo(vec<int> $_): void {}
}
function main(I $i, dynamic $d): void {
$i->foo($d);
} |
PHP | hhvm/hphp/hack/test/sdt_analysis/solve/implements2.php | <?hh
interface I {
public function foo(vec<int> $_): void;
}
final class C implements I {
public function foo(vec<int> $_): void {}
} |
PHP | hhvm/hphp/hack/test/sdt_analysis/solve/multiple_hierarchies.php | <?hh
// this test shows that the same class-like item
// (in this case I) can be included in multiple
// `__NoAutoDynamic`able lists
interface I {
public function foo(vec<int> $_): void;
}
final class C implements I {
public function foo(vec<int> $_): void {}
}
final class D implements I {
public function foo(vec<int> $_): void {}
}
final class E {} |
PHP | hhvm/hphp/hack/test/sdt_analysis/solve/reference_hhi.php | <?hh
final class A extends ClassFromHhi1 {} // `__NoAutoDynamic`-able
final class B extends ClassFromHhi2 {} // `__NoAutoDynamic`-able
function main(dynamic $dyn): void { // `__NoAutoDynamic`-able
ClassFromHhi1::meth($dyn);
} |
PHP | hhvm/hphp/hack/test/sdt_analysis/solve/traits_require_class1.php | <?hh
<<file:__EnableUnstableFeatures('require_class')>>
abstract class Abs {
public abstract function foo(vec<int> $v): void;
}
trait Tr {
require class C;
}
final class C extends Abs {
use Tr;
public function foo(vec<int> $v): void {}
}
function foo(Abs $i, dynamic $dyn): void {
$i->foo($dyn);
} |
PHP | hhvm/hphp/hack/test/sdt_analysis/solve/traits_require_extends1.php | <?hh
abstract class Abs {
public abstract function foo(vec<int> $v): void;
}
trait Tr1 {
require extends Abs;
public function foo(vec<int> $_): void {}
}
final class C extends Abs {
use Tr1;
}
function foo(Abs $i, dynamic $dyn): void {
$i->foo($dyn);
} |
PHP | hhvm/hphp/hack/test/sdt_analysis/solve/traits_require_implements1.php | <?hh
interface I {
public function foo(vec<int> $v): void;
}
trait Tr {
require implements I;
public function foo(vec<int> $_): void {}
}
class C implements I {
use Tr;
}
function foo(I $i, dynamic $dyn): void {
$i->foo($dyn);
} |
hhvm/hphp/hack/test/sdt_analysis/solve_incorrect_tcopt/dune | (rule
(alias sdt_analysis_solve_incorrect_tcopt)
(deps
%{exe:../../../src/hh_single_type_check.exe}
%{project_root}/hack/test/verify.py
%{project_root}/hack/test/review.sh
%{project_root}/hack/test/sdt_analysis/solve_incorrect_tcopt/HH_FLAGS
(glob_files %{project_root}/hack/test/sdt_analysis/solve_incorrect_tcopt/*.php)
(glob_files %{project_root}/hack/test/sdt_analysis/solve_incorrect_tcopt/*.php.exp))
(action
(run
%{project_root}/hack/test/verify.py
%{project_root}/hack/test/sdt_analysis/solve_incorrect_tcopt
--program
%{exe:../../../src/hh_single_type_check.exe}
--in-extension
.php
--flags
--sdt-analysis
solve
--error-format
plain)))
(alias
(name runtest)
(deps
(alias sdt_analysis_solve_incorrect_tcopt))) |
|
PHP | hhvm/hphp/hack/test/shallow_class_diff/constructor_consistency_changed.php | <?hh
//<<__ConsistentConstruct>>
class A {}
//<<__ConsistentConstruct>>
class B {
public function __construct() {}
} |
hhvm/hphp/hack/test/shallow_class_diff/constructor_consistency_changed.php.after | <?hh
<<__ConsistentConstruct>>
class A {}
<<__ConsistentConstruct>>
class B {
public function __construct() {}
} |
|
hhvm/hphp/hack/test/shallow_class_diff/dune | (rule
(alias shallow_class_diff)
(deps
%{exe:../../src/hh_single_type_check.exe}
%{project_root}/hack/test/verify.py
%{project_root}/hack/test/review.sh
(glob_files %{project_root}/hack/test/shallow_class_diff/*.php)
(glob_files %{project_root}/hack/test/shallow_class_diff/*.php.after)
(glob_files %{project_root}/hack/test/shallow_class_diff/*.exp)
(glob_files %{project_root}/hack/test/shallow_class_diff/HH_FLAGS))
(action
(run
%{project_root}/hack/test/verify.py
%{project_root}/hack/test/shallow_class_diff
--program
%{exe:../../src/hh_single_type_check.exe})))
(alias
(name runtest)
(deps
(alias shallow_class_diff))) |
|
hhvm/hphp/hack/test/shallow_class_diff/member_added.php.after | <?hh
class C {
const int X = 0;
const type T = int;
public ?int $x;
public static ?int $y;
public function f(): void {}
public static function g(): void {}
public function __construct() {}
} |
|
PHP | hhvm/hphp/hack/test/shallow_class_diff/member_became_abstract.php | <?hh
abstract class C {
const type T = int;
public ?int $x;
public static ?int $y;
public function f(): void {}
public static function g(): void {}
public function __construct() {}
} |
hhvm/hphp/hack/test/shallow_class_diff/member_became_abstract.php.after | <?hh
abstract class C {
abstract const type T as int;
public abstract ?int $x;
public abstract static ?int $y;
public abstract function f(): void {}
public abstract static function g(): void {}
public abstract function __construct() {}
} |
|
PHP | hhvm/hphp/hack/test/shallow_class_diff/member_modified.php | <?hh
class C {
const int X = 0;
const type T = int;
private ?int $x;
private static ?int $y;
private function f(): void {}
private static function g(): void {}
public function __construct() {}
} |
hhvm/hphp/hack/test/shallow_class_diff/member_modified.php.after | <?hh
class C {
const num X = 0;
const type T = num;
private ?num $x;
private static ?num $y;
private function f(): int { return 0; }
private static function g(): int { return 0; }
public function __construct(int $_) {}
} |
|
PHP | hhvm/hphp/hack/test/shallow_class_diff/member_removed.php | <?hh
class C {
const int X = 0;
const type T = int;
public ?int $x;
public static ?int $y;
public function f(): void {}
public static function g(): void {}
public function __construct() {}
} |
PHP | hhvm/hphp/hack/test/shallow_class_diff/mro_positions_changed.php | <?hh
class C implements I {
use T;
const int X = 0;
const type T = int;
private ?int $x;
private static ?int $y;
private function f(): void {}
private static function g(): void {}
} |
hhvm/hphp/hack/test/shallow_class_diff/mro_positions_changed.php.after | <?hh
class C
implements I {
use T;
const int X = 0;
const type T = int;
private ?int $x;
private static ?int $y;
private function f(): void {}
private static function g(): void {}
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.