• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2024-2025 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16let a = [1, ..., 2];
17
18[a..., 55] = f();
19
20[...x..., 78]
21
22let f = 8 => 7;
23
24let a = (x: int, y..., ): void => {};
25
26if (x ||= 10) {}
27
28let a = `The ${a+10)}`;
29
30let a = new import(10);
31
32function f(x: int): void {
33    super(x);
34}
35
36a?.[1+2);
37
38let a = [1, 2, 3);
39/* @@? 16:16 Error SyntaxError: Unexpected token ','. */
40/* @@? 16:18 Error SyntaxError: Unexpected token, expected ',' or ']'. */
41/* @@? 16:18 Error SyntaxError: Unexpected token '2'. */
42/* @@? 16:19 Error SyntaxError: Unexpected token ']'. */
43/* @@? 18:3 Error SyntaxError: Unexpected token, expected ',' or ']'. */
44/* @@? 18:3 Error SyntaxError: Unexpected token '...'. */
45/* @@? 18:6 Error SyntaxError: Unexpected token ','. */
46/* @@? 18:8 Error SyntaxError: Unexpected token '55'. */
47/* @@? 18:10 Error SyntaxError: Unexpected token ']'. */
48/* @@? 20:5 Error TypeError: Unresolved reference x */
49/* @@? 20:6 Error SyntaxError: Unexpected token, expected ',' or ']'. */
50/* @@? 20:6 Error SyntaxError: Unexpected token '...'. */
51/* @@? 20:9 Error SyntaxError: Unexpected token ','. */
52/* @@? 20:11 Error SyntaxError: Unexpected token '78'. */
53/* @@? 20:13 Error SyntaxError: Unexpected token ']'. */
54/* @@? 22:11 Error SyntaxError: Unexpected token '=>'. */
55/* @@? 22:11 Error SyntaxError: Unexpected token. */
56/* @@? 24:5 Error TypeError: Variable 'a' has already been declared. */
57/* @@? 24:18 Error TypeError: The type of parameter 'y' cannot be inferred */
58/* @@? 24:19 Error SyntaxError: Unexpected token, expected ',' or ')'. */
59/* @@? 24:19 Error SyntaxError: Expected '=>', got '...'. */
60/* @@? 24:19 Error SyntaxError: Unexpected token '...'. */
61/* @@? 24:24 Error SyntaxError: Identifier expected, got ')'. */
62/* @@? 24:32 Error SyntaxError: Unexpected token '=>'. */
63/* @@? 24:35 Error SyntaxError: Unexpected token '{'. */
64/* @@? 26:7 Error SyntaxError: Unexpected token '||='. */
65/* @@? 28:5 Error TypeError: Variable 'a' has already been declared. */
66/* @@? 28:20 Error SyntaxError: Expected '}', got ')'. */
67/* @@? 30:5 Error TypeError: Variable 'a' has already been declared. */
68/* @@? 30:13 Error SyntaxError: Unexpected token 'import'. */
69/* @@? 30:13 Error SyntaxError: Import declarations can only be used on the top level and before any other declaration, top level statement or directive. */
70/* @@? 30:13 Error SyntaxError: Invalid Type. */
71/* @@? 32:10 Error TypeError: Variable 'f' has already been declared. */
72/* @@? 33:5 Error TypeError: Call to 'super' must be first statement in constructor */
73/* @@? 33:5 Error TypeError: Expected 0 arguments, got 1. */
74/* @@? 33:5 Error TypeError: No matching call signature for std.core.Object(int) */
75/* @@? 33:10 Error SyntaxError: Unexpected super keyword. */
76/* @@? 36:1 Error TypeError: Indexed access is not supported for such expression type. */
77/* @@? 36:8 Error SyntaxError: Unexpected token, expected ']'. */
78/* @@? 38:5 Error TypeError: Variable 'a' has already been declared. */
79/* @@? 38:17 Error SyntaxError: Unexpected token ')'. */
80/* @@? 38:17 Error SyntaxError: Unexpected token, expected ',' or ']'. */
81