• 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 enum ELetInsteadOfConst {
17  Member1,
18  Member2,
19  Member3
20}
21
22enum EWrongLeftBrace (
23  Member1 = 1,
24  Member2 = 2,
25  Member3 = 3
26}
27
28enum EWrongRightBrace {
29  Member1 = 10,
30  Member2 = 100,
31  Member3 = 1000
32]
33
34enum EBadNum {
35  Num1 = 1,
36  Num2 = 2,
37  Num3 = !
38}
39
40enum EBadString {
41  Str1 = "str1",
42  Str2 = "str2",
43  Str3 = ?
44}
45
46enum EMissingComma {
47  Member1
48  Member2
49}
50
51enum ETrailingComma {
52  Str1 = "str1",
53}
54
55enum MissingLeftBrace
56  Member1,
57  Member2
58}
59
60
61/* @@? 16:5 Error SyntaxError: Variable declaration expected. */
62/* @@? 22:22 Error SyntaxError: Unexpected token, expected '{'. */
63/* @@? 32:1 Error SyntaxError: Unexpected token, expected ',' or '}'. */
64/* @@? 32:1 Error SyntaxError: Unexpected token ']'. */
65/* @@? 37:10 Error SyntaxError: Only constant expression is expected in the field */
66/* @@? 37:10 Error TypeError: Enumeration members can be initialized only by compile-time expressions and initializers must be of the same type. */
67/* @@? 38:1 Error SyntaxError: Unexpected token '}'. */
68/* @@? 40:1 Error SyntaxError: Unexpected token, expected ',' or '}'. */
69/* @@? 43:10 Error SyntaxError: Unexpected token '?'. */
70/* @@? 43:10 Error TypeError: Enumeration members can be initialized only by compile-time expressions and initializers must be of the same type. */
71/* @@? 48:3 Error SyntaxError: Unexpected token, expected ',' or '}'. */
72/* @@? 48:3 Error TypeError: Unresolved reference Member2 */
73/* @@? 49:1 Error SyntaxError: Unexpected token '}'. */
74/* @@? 56:3 Error SyntaxError: Unexpected token, expected '{'. */
75/* @@? 56:10 Error SyntaxError: Identifier expected, got ','. */
76/* @@? 57:3 Error SyntaxError: Unexpected token, expected ',' or '}'. */
77/* @@? 58:1 Error SyntaxError: Unexpected token '}'. */
78