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
16@Sendable
17class SendableClassA {
18    a: number = 1;
19}
20
21@Sendable
22class SendableClassB {
23    b: SendableClassA = new SendableClassA();
24}
25
26@Sendable
27class SendableClassC {
28    static a: number = 1;
29}
30
31@Sendable
32class SendableClassD {
33    b: number = SendableClassC.a;
34}
35
36@Sendable
37class SendableClassE {
38  static public a: number = 1;
39  f(p: number) {
40    @Sendable
41    class SendableClassF { 
42      public b: number = SendableClassE.a;
43    }
44  }
45}
46
47if (true) {
48    @Sendable
49    class SendableClassG {
50        static a: number = 1;
51    }
52
53    @Sendable
54    class SendableClassH {
55        b: SendableClassG = new SendableClassG(); //ERROR
56    }
57}
58
59let a: number = 1
60
61@Sendable
62class SendableClassI {
63    b: number = a; //ERROR
64}
65
66
67@Sendable
68class SendableClassJ {
69    p: number = 1;
70}
71let b:SendableClassJ = new SendableClassJ();
72
73@Sendable
74class SendableClassK {
75    ma: SendableClassJ = b; // ERROR
76}
77
78//
79
80@Sendable
81class SendableLocalClassA {
82
83}
84
85@Sendable
86function sendableFunctionA() {
87
88};
89
90@Sendable
91export class SendableLocalClassB {
92
93}
94
95@Sendable
96export function sendableFunctionB() {
97
98};
99
100@Sendable
101class SendableLocalClassC {
102
103}
104
105@Sendable
106function sendableFunctionC() {
107
108};
109
110@Sendable
111class SendableLocalClassD {
112
113}
114
115@Sendable
116function sendableFunctionD() {
117
118};
119
120@Sendable
121class SendableLocalClassE {
122
123}
124
125@Sendable
126function sendableFunctionE() {
127
128};
129
130@Sendable 
131class SendableClass {
132  handle() {
133    new SendableLocalClassA(); // OK
134    sendableFunctionA(); // OK
135    new SendableLocalClassB(); // WARING, export decl
136    sendableFunctionB(); // WARING, export decl
137    new SendableLocalClassC(); // WARING, export { decl }
138    sendableFunctionC(); // WARING, export { decl }
139    new SendableLocalClassD(); // WARING, export { decl as alias }
140    sendableFunctionD(); // WARING, export { decl as alias }
141    new SendableLocalClassE(); // WARING, export default decl
142  }
143}
144
145@Sendable
146function sendableFunction() {
147    new SendableLocalClassA(); // OK
148    sendableFunctionA(); // OK
149    new SendableLocalClassB(); // WARING, export decl
150    sendableFunctionB(); // WARING, export decl
151    new SendableLocalClassC(); // WARING, export { decl }
152    sendableFunctionC(); // WARING, export { decl }
153    new SendableLocalClassD(); // WARING, export { decl as alias }
154    sendableFunctionD(); // WARING, export { decl as alias }
155    new SendableLocalClassE(); // WARING, export default decl
156}
157
158export { SendableLocalClassC, sendableFunctionC, SendableLocalClassD as Sc42, sendableFunctionD as sf42 };
159
160
161export default SendableLocalClassE;