• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2024 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// This line should be the last line to correctly test closing brace.
40
41/* @@? 16:16 Error SyntaxError: Unexpected token ','.  */
42/* @@? 18:3 Error SyntaxError: Unexpected token, expected ',' or ']'  */
43/* @@? 18:8 Error SyntaxError: Unexpected token 'number literal'.  */
44/* @@? 18:10 Error SyntaxError: Unexpected token ']'.  */
45/* @@? 18:10 Error SyntaxError: Unexpected token ']'.  */
46/* @@? 18:12 Error SyntaxError: Unexpected token '='.  */
47/* @@? 20:6 Error SyntaxError: Unexpected token, expected ',' or ']'  */
48/* @@? 20:11 Error SyntaxError: Unexpected token 'number literal'.  */
49/* @@? 20:13 Error SyntaxError: Unexpected token ']'.  */
50/* @@? 20:13 Error SyntaxError: Unexpected token ']'.  */
51/* @@? 22:11 Error SyntaxError: Unexpected token: '=>'.  */
52/* @@? 22:11 Error SyntaxError: Unexpected token, arrow (=>)  */
53/* @@? 24:19 Error SyntaxError: Invalid token: ',' or ')' expected.  */
54/* @@? 24:22 Error SyntaxError: Unexpected token, expected: '=>'.  */
55/* @@? 24:24 Error SyntaxError: Unexpected token ')'.  */
56/* @@? 24:24 Error SyntaxError: Unexpected token ')'.  */
57/* @@? 24:24 Error SyntaxError: Unexpected token ')'.  */
58/* @@? 24:25 Error SyntaxError: Unexpected token ':'.  */
59/* @@? 24:27 Error SyntaxError: Unexpected token 'identification literal'.  */
60/* @@? 24:32 Error SyntaxError: Unexpected token '=>'.  */
61/* @@? 26:7 Error SyntaxError: Unexpected token: '||='.  */
62/* @@? 28:20 Error SyntaxError: Unexpected token, expected: '}'.  */
63/* @@? 30:13 Error SyntaxError: Invalid Type  */
64/* @@? 33:10 Error SyntaxError: Unexpected super keyword  */
65/* @@? 36:8 Error SyntaxError: Unexpected token, expected: ']'.  */
66/* @@? 38:17 Error SyntaxError: Unexpected token, expected ',' or ']'  */
67