chore(tests): consistent captures

This commit is contained in:
Christian Clason 2023-12-24 12:52:21 +01:00
parent 17fae3f4a3
commit 10dd49958c
60 changed files with 872 additions and 873 deletions

View file

@ -1,6 +1,6 @@
foreach (($array as vec[]) as $item) {}
// ^ repeat
// ^ type
// ^ @repeat
// ^ @type
# Our expectation test for the code below intentionally includes an ERROR.
foreach ($array as vec[] as $item) {}

View file

@ -1,8 +1,8 @@
async function func0(): void {}
// ^ type.builtin
// ^ @type.builtin
async function func1<T1 as int>() {}
// ^ type.builtin
// ^ keyword.operator
// ^ @type.builtin
// ^ @keyword.operator
async ($x) ==> $x + 1;

View file

@ -2,13 +2,13 @@
newtype T1 = ?shape(
// TODO: ?operator (? not captureable at the moment)
?'int' => int
// ^ operator
// ^ @operator
);
<<A3(1), A2(2,3,)>>
// ^ attribute
// ^ @attribute
type T2 = (function(T1): string);
// ^ type
// ^ @type
// TODO: keyword.function (currently not in AST)
<<A4(1), A5, A6(1,3,4)>>

View file

@ -1,24 +1,24 @@
class Box<T> {
// ^ type
// ^ type
// ^ @type
// ^ @type
protected T $data;
// ^ type.qualifier
// ^ type
// ^ @type.qualifier
// ^ @type
public function __construct(T $data) {
// ^ type
// ^ parameter
// ^ keyword.function
// ^ type.qualifier
// ^ method
// ^ @type
// ^ @parameter
// ^ @keyword.function
// ^ @type.qualifier
// ^ @method
$this->data = $data;
}
public function getData(): T {
// ^ method
// ^ type.qualifier
// ^ @method
// ^ @type.qualifier
return $this->data;
// ^ operator
// ^ variable.builtin
// ^ @operator
// ^ @variable.builtin
}
}

View file

@ -1,4 +1,4 @@
<<<EOT
$('a') abc $(function{return;})
EOT;
// <- comment ^ comment
// <- @comment ^ @comment

View file

@ -1,12 +1,12 @@
class C extends Superclass implements Iface {
// ^ keyword ^ keyword
// ^ @keyword ^ @keyword
use Trait;
// < include
// <- @include
const type X = shape(
// <- keyword ^ type.builtin
// <- @keyword ^ @type.builtin
"a" => int,
// ^ string
// ^ @string
"b" => string,
// ^ type.builtin
// ^ @type.builtin
);
}

View file

@ -1,28 +1,28 @@
use const Space\Const\C;
// ^ keyword
// ^ constant
// ^ @keyword
// ^ @constant
use function Space\Func\F as E;
// ^ function
// ^ function
// ^ @function
// ^ @function
use type Space\Type\T;
// ^ keyword
// ^ @keyword
use namespace Space\Name\N as M;
// ^ keyword
// ^ namespace
// ^ @keyword
// ^ @namespace
use namespace Space\Name2\N2, Space\Nothing\N3 as N8, type Space\Type2\N4,;
// ^ namespace
// ^ type
// ^ @namespace
// ^ @type
use namespace Space\Name\N10\{A as A2, B\};
// ^ namespace
// ^ namespace
// ^ namespace
// ^ @namespace
// ^ @namespace
// ^ @namespace
use namespace Space\Name\{\C, Slash as Forward};
use \What\Is\This\{function A as A2, B, const H\S\L as stdlib, function F};
use type \{kind,};
use Q\B\{kind2,};
// ^ namespace
// ^ @namespace
use type Q\B\{kind3,};
// <- include
// <- @include

View file

@ -1,3 +1,3 @@
using ($new = new Object(), $file = new File('using', '+using')) {}
// <- keyword
// ^ type
// <- @keyword
// ^ @type

View file

@ -4,7 +4,7 @@ echo "<tt>Hello <strong>$user_name</tt></strong>";
// XHP: Typechecked, well-formed, and secure
$user_name = 'Andrew';
$xhp = <tt>Hello <strong>{$user_name}</strong></tt>;
// ^ tag
// ^ tag
// ^ string
// ^ @tag
// ^ @tag
// ^ @string
echo await $xhp->toStringAsync();