1/*
2 * Copyright (c) 2022-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
16import { ff } from "./oh_modules/ohos_lib";
17import { f, f2, bar, applyToUnknown, fooExecute, C1, myFoo, myFoo2 } from "./dynamic_lib";
18
19let a1: C1 = new C1()
20
21function g1(): C1 | null {
22    if (a1) {
23        return a1
24    }
25    return null
26}
27
28f2(g1())
29
30bar(null);
31bar(null, null);
32applyToUnknown(null);
33fooExecute(null);
34
35function fff(a: Array<number>): void {}
36
37fff(null);
38ff(null);
39f(null);
40
41
42((a: number) => a)(null);
43(a: null | number) => ((b: number) => b)(a);
44
45function inc(a: number) { return a + 1 }
46function neg2null(x: number) { return x > 0 ? x : null }
47inc(neg2null(-1));
48
49myFoo({x: "", y: null})
50
51class A2 {
52    public a: Object = null
53    f() {
54        myFoo2(
55            () => {
56                this.a = null;
57            }
58        )
59    }
60}