diff --git a/ets2panda/test/runtime/ets/ensure_not_nullish_expression.ets b/ets2panda/test/runtime/ets/ensure_not_nullish_expression.ets new file mode 100644 index 0000000000000000000000000000000000000000..269440f17132f09cb8da0031b2b66e8f70bc128b --- /dev/null +++ b/ets2panda/test/runtime/ets/ensure_not_nullish_expression.ets @@ -0,0 +1,24 @@ +/* + * 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. + */ + +function test(p: boolean, x: number|null): number{ + let v : object|null = null; + return (p ? v : x)! + 1; +} + +function main(): void{ + let a: number|null = 5; + console.log(test(false, a)); +} \ No newline at end of file