diff --git a/ets2panda/checker/ets/utilityTypeHandlers.cpp b/ets2panda/checker/ets/utilityTypeHandlers.cpp index e318d53897845606b40853d64b8f23638933d166..9cee013fab405c9eaca77d869b52fcd5276298ea 100644 --- a/ets2panda/checker/ets/utilityTypeHandlers.cpp +++ b/ets2panda/checker/ets/utilityTypeHandlers.cpp @@ -126,6 +126,11 @@ Type *ETSChecker::CreatePartialType(Type *const typeToBePartial) return typeToBePartial; } + // If TypeParam is not used, it can be ETSNeverType, please refers to function_helpers.h + if (typeToBePartial->IsETSNeverType()) { + return typeToBePartial; + } + if (typeToBePartial->IsETSTypeParameter()) { return CreatePartialTypeParameter(typeToBePartial->AsETSTypeParameter()); } diff --git a/ets2panda/test/runtime/ets/partial_never.ets b/ets2panda/test/runtime/ets/partial_never.ets new file mode 100644 index 0000000000000000000000000000000000000000..8262e5f8ecbfbbee753f425e58d6853057d40251 --- /dev/null +++ b/ets2panda/test/runtime/ets/partial_never.ets @@ -0,0 +1,23 @@ +/** + * Copyright (c) 2025 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 foo() : Array> { + return new Array>(); +} + +function main() { + foo(); + assertTrue(true); +}