/*
 * Copyright (c) 2024 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an 'AS IS' BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
import assert from 'assert';
let k: number = 1;
assert.strictEqual(k, 1);
function g(): number {
    return k;
}
assert.strictEqual(g(), 1);
function h(r: boolean): number {
    let s: number = 2;
    {
        let t: number = 3;
        assert.strictEqual(t, 3);
    }
    if (r) {
        return s;
    }
    else {
        // @ts-expect-error
        return value3; // This will cause an error as value3 is not defined in this scope
    }
}
assert.strictEqual(h(true), 2);
try {
    h(false);
}
catch (q) {
    assert.strictEqual((q as ReferenceError).name, 'ReferenceError');
    assert.strictEqual((q as ReferenceError).message, 'value3 is not defined');
}
function i(n: boolean, o: number): number {
    if (n) {
        let p: number = 100;
        return p;
    }
    return o;
}
assert.strictEqual(i(false, 0), 0);
assert.strictEqual(i(true, 0), 100);
function j(): string {
    let l: () => string;
    if (true) {
        let m: string = 'hello';
        l = function () {
            return m;
        };
    }
    return l();
}
assert.strictEqual(j(), 'hello');
