Skip to content

Commit

Permalink
Add final/abstract identifiers to tests where appropriate
Browse files Browse the repository at this point in the history
  • Loading branch information
muglug committed May 21, 2024
1 parent 9bf7692 commit 3c222a8
Show file tree
Hide file tree
Showing 449 changed files with 693 additions and 688 deletions.
2 changes: 1 addition & 1 deletion tests/diff/addClassInOtherFile/b/A.hack
Original file line number Diff line number Diff line change
@@ -1 +1 @@
class A {}
final class A {}
2 changes: 1 addition & 1 deletion tests/diff/addTrait/a/input.hack
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ trait T {
public function foo(): void {}
}

class C {
final class C {
}

function foo(C $c) {
Expand Down
2 changes: 1 addition & 1 deletion tests/diff/addTrait/b/input.hack
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ trait T {
public function foo(): void {}
}

class C {
final class C {
use T;
}

Expand Down
2 changes: 1 addition & 1 deletion tests/diff/changeAliasedShapeType/a/input.hack
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ function main(): void {
A::takes_bar(shape('a' => foo_t::A));
}

class A {
final class A {
public static function takes_bar(bar_t $b) {
if ($b['a'] == foo_t::A) {}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/diff/changeAliasedShapeType/b/input.hack
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ function main(): void {
A::takes_bar(shape('a' => foo_t::A));
}

class A {
final class A {
public static function takes_bar(bar_t $b) {
if ($b['a'] == foo_t::A) {}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/diff/changeAliasedShapeType/c/input.hack
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ function main(): void {
A::takes_bar(shape('a' => Foo::A));
}

class A {
final class A {
public static function takes_bar(bar_t $b) {
if ($b['a'] == Foo::A) {}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/diff/changePrivateMethodBehaviour/a/input.hack
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class A {
final class A {
public function foo(): void {
$this->bar();
}
Expand Down
2 changes: 1 addition & 1 deletion tests/diff/changePrivateMethodBehaviour/b/input.hack
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class A {
final class A {
public function foo(): void {
$this->bar();
}
Expand Down
2 changes: 1 addition & 1 deletion tests/diff/classConstTypeChanged/a/input.hack
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ abstract class A {
abstract const type T;
}

class B extends A {
final class B extends A {
const type T = vec<string>;

public function bar(): void {}
Expand Down
2 changes: 1 addition & 1 deletion tests/diff/classConstTypeChanged/b/input.hack
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ abstract class A {
abstract const type T;
}

class B extends A {
final class B extends A {
const type T = vec<Exception>;

public function bar(): void {}
Expand Down
2 changes: 1 addition & 1 deletion tests/diff/commentOutClassInOtherFile/a/A.hack
Original file line number Diff line number Diff line change
@@ -1 +1 @@
class A extends Exception {}
final class A extends Exception {}
2 changes: 1 addition & 1 deletion tests/diff/commentOutClassInOtherFile/a/input.hack
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ function bar(): void {
echo A::class;
}

class B {
final class B {
public function baz(): void {
echo A::class;
}
Expand Down
2 changes: 1 addition & 1 deletion tests/diff/commentOutClassInOtherFile/b/input.hack
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ function bar(): void {
echo A::class;
}

class B {
final class B {
public function baz(): void {
echo A::class;
}
Expand Down
2 changes: 1 addition & 1 deletion tests/diff/extendedRefLost/a/input.hack
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
abstract class A {}

class B extends A {}
final class B extends A {}

function foo(): void {}

Expand Down
2 changes: 1 addition & 1 deletion tests/diff/extendedRefLost/b/input.hack
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
abstract class A {}

class B {}
final class B {}

function foo(): void {}

Expand Down
2 changes: 1 addition & 1 deletion tests/diff/methodUsedThroughTrait/a/input.hack
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ trait ParentTrait {
public function doThing(): void {}
}

class ConcreteClass extends ParentClass {
final class ConcreteClass extends ParentClass {
use ParentTrait;
}

Expand Down
2 changes: 1 addition & 1 deletion tests/diff/methodUsedThroughTrait/b/input.hack
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ trait ParentTrait {
public function doThing(): void {}
}

class ConcreteClass extends ParentClass {
final class ConcreteClass extends ParentClass {
use ParentTrait;
}

Expand Down
2 changes: 1 addition & 1 deletion tests/diff/methodWithErrorSuppressed/a/input.hack
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class A {
final class A {
public function foo(vec<string> $vecs): void {
echo "a";
if ($vecs is nonnull) {}
Expand Down
2 changes: 1 addition & 1 deletion tests/diff/methodWithErrorSuppressed/b/input.hack
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class A {
final class A {
public function foo(vec<string> $vecs): void {
echo "a";
/* HAKANA_FIXME[RedundantNonnullTypeComparison] */
Expand Down
2 changes: 1 addition & 1 deletion tests/diff/removeClassInOtherFile/a/A.hack
Original file line number Diff line number Diff line change
@@ -1 +1 @@
class A {}
final class A {}
2 changes: 1 addition & 1 deletion tests/diff/removeParentMethod/a/input.hack
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class B extends A {
final class B extends A {
public function bar(): void {
$this->foo();
}
Expand Down
2 changes: 1 addition & 1 deletion tests/diff/removeParentMethod/a/parent.hack
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
class A {
abstract class A {
public function foo(): void {}
}
2 changes: 1 addition & 1 deletion tests/diff/removeParentMethod/b/input.hack
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class B extends A {
final class B extends A {
public function bar(): void {
$this->foo();
}
Expand Down
2 changes: 1 addition & 1 deletion tests/diff/removeParentMethod/b/parent.hack
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
class A {
abstract class A {

}
2 changes: 1 addition & 1 deletion tests/diff/removeTrait/a/input.hack
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ trait T {
public function foo(): void {}
}

class C {
final class C {
use T;
}

Expand Down
2 changes: 1 addition & 1 deletion tests/diff/removeTrait/b/input.hack
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ trait T {
public function foo(): void {}
}

class C {
final class C {
}

function foo(C $c) {
Expand Down
2 changes: 1 addition & 1 deletion tests/diff/replaceImplementationAndUse/a/input.hack
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class A {
final class A {
private function __construct(private int $i) {}

public static function gen(): A {
Expand Down
2 changes: 1 addition & 1 deletion tests/diff/replaceImplementationAndUse/b/input.hack
Original file line number Diff line number Diff line change
@@ -1 +1 @@
class A { }
final class A { }
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
class A {
abstract class A {
private function __construct(private int $i) {}

public function returnSelf() : A {
return new A(5);
}
}

class B extends A {
final class B extends A {
public function returnSelf(): A {
return parent::returnSelf();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
class A { }
final class A { }
2 changes: 1 addition & 1 deletion tests/diff/uncommentClassInOtherFile/a/input.hack
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function bar(): void {
echo A::class;
}

class B {
final class B {
public function baz(): void {
echo A::class;
}
Expand Down
2 changes: 1 addition & 1 deletion tests/diff/uncommentClassInOtherFile/b/A.hack
Original file line number Diff line number Diff line change
@@ -1 +1 @@
class A extends Exception {}
final class A extends Exception {}
2 changes: 1 addition & 1 deletion tests/diff/uncommentClassInOtherFile/b/input.hack
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function bar(): void {
echo A::class;
}

class B {
final class B {
public function baz(): void {
echo A::class;
}
Expand Down
2 changes: 1 addition & 1 deletion tests/diff/unusedFunctionRemovedWholeFile/a/input.hack
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ function main(): void {
new B();
}

class B {}
final class B {}
2 changes: 1 addition & 1 deletion tests/diff/unusedFunctionRemovedWholeFile/b/input.hack
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
function main(): void {
}

class B {}
final class B {}
4 changes: 2 additions & 2 deletions tests/fix/UnusedClass/removeUnusedClass/input.hack
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// This is my class
// it is not used
class A {
final class A {
// some stuff
}

class B {}
final class B {}

<<__EntryPoint>>
function foo(): void {
Expand Down
2 changes: 1 addition & 1 deletion tests/fix/UnusedClass/removeUnusedClass/output.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@


class B {}
final class B {}

<<__EntryPoint>>
function foo(): void {
Expand Down
2 changes: 1 addition & 1 deletion tests/fix/UnusedPrivateMethod/simple/input.hack
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class Foo {
final class Foo {
/** cool doc */
private function bar(): void {}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/fix/UnusedPrivateMethod/simple/output.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class Foo {
final class Foo {
}

<<__EntryPoint>>
Expand Down
2 changes: 1 addition & 1 deletion tests/inference/Arg/callMapClassOptionalArg/input.hack
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
class Hello {}
final class Hello {}
$m = new ReflectionMethod(Hello::class, "goodbye");
$m->invoke(null, "cool");
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class Arr {
final class Arr {
public static function pull(inout dict<string, mixed> $a, string $b, mixed $c = null): mixed {
return $a[$b] ?? $c;
}
Expand Down
2 changes: 1 addition & 1 deletion tests/inference/ArrayAccess/instanceOfIntOffset/input.hack
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class A {
final class A {
public function fooFoo(): void { }
}
function bar (vec<mixed> $a): void {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class A {
final class A {
public function fooFoo(): void { }
}
function bar (dict<string, mixed> $a): void {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class A {
final class A {
public function __toString(){return "";}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class A {
final class A {
public dict<arraykey, mixed> $arr = dict[];

public function foo() : void {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class Collection {
final class Collection {
private vec<string> $list = dict[];

public function override(int $offset): void {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class A {
final class A {
public function getRows() : vec<?A> {
return vec[new A(), null];
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

class A {
final class A {
private dict<classname<A>, string> $a;

public function __construct() {
Expand Down
4 changes: 2 additions & 2 deletions tests/inference/Async/awaitNullable/input.hack
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
class A {
final class A {
public async function bar(): Awaitable<string> {
return "a";
}
}

class Boo {
final class Boo {
public static async function getA(): Awaitable<?A> {
return new A();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class B {
final class B {
public function bar(): ?string {
return "a";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,22 @@
namespace NamespaceOne {
use Attribute;

class FooAttribute implements HH\ClassAttribute
final class FooAttribute implements HH\ClassAttribute
{
public function __construct(private classname<FoobarInterface> $className)
{}
}

interface FoobarInterface {}

class Bar implements FoobarInterface {}
final class Bar implements FoobarInterface {}
}

namespace NamespaceTwo {
use NamespaceOne\FooAttribute;
use NamespaceOne\Bar as ZZ;

<<FooAttribute(ZZ::class)>>
class Baz {}
final class Baz {}
}

Loading

0 comments on commit 3c222a8

Please sign in to comment.