• 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
16class A {
17    public a = this.b
18    public b = this.a
19}
20
21class B {
22    public static a = B.b
23    public static b = B.a
24}
25
26class C {
27    public static a = C.b
28    public static b = 0
29}
30
31let globala = globalb
32
33let globalc = globald
34let globald = globalc
35
36const consta = constb;
37const constb = consta;
38
39function main() {
40    let maina = mainb;
41
42    let mainc = maind;
43    let maind = mainc;
44}
45
46/* @@? 18:12 Error TypeError: Circular dependency detected for identifier: b */
47/* @@? 23:19 Error TypeError: Circular dependency detected for identifier: b */
48/* @@? 31:15 Error TypeError: Unresolved reference globalb */
49/* @@? 33:5 Error TypeError: Circular dependency detected for identifier: globalc */
50/* @@? 37:7 Error TypeError: Circular dependency detected for identifier: constb */
51/* @@? 40:17 Error TypeError: Unresolved reference mainb */
52/* @@? 42:17 Error TypeError: Variable 'maind' is accessed before it's initialization. */
53/* @@? 43:9 Error TypeError: Circular dependency detected for identifier: maind */
54