diff --git a/ets2panda/checker/ets/utilityTypeHandlers.cpp b/ets2panda/checker/ets/utilityTypeHandlers.cpp index 1041ab4faf7387d6e0cc0f3568786254393c0d47..35d8f7d50dacb180dc62475f9fb251203d295df2 100644 --- a/ets2panda/checker/ets/utilityTypeHandlers.cpp +++ b/ets2panda/checker/ets/utilityTypeHandlers.cpp @@ -118,11 +118,7 @@ static T *CloneNodeIfNotNullptr(T *node, ArenaAllocator *allocator) Type *ETSChecker::CreatePartialType(Type *const typeToBePartial) { ES2PANDA_ASSERT(typeToBePartial->IsETSReferenceType()); - if (typeToBePartial->IsTypeError()) { - return typeToBePartial; - } - - if (typeToBePartial->IsETSAnyType()) { + if (typeToBePartial->IsTypeError() || typeToBePartial->IsETSNeverType() || typeToBePartial->IsETSAnyType()) { return typeToBePartial; } diff --git a/ets2panda/test/ast/compiler/ets/unresolve_class_with_type_infer.ets b/ets2panda/test/ast/compiler/ets/unresolve_class_with_type_infer.ets new file mode 100644 index 0000000000000000000000000000000000000000..9347301cc3f96cac0dba997c2b30dd0fec9a5b9e --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/unresolve_class_with_type_infer.ets @@ -0,0 +1,22 @@ +/* + * 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>(record: Record>){ + +} + +foo({}) + +/* @@? 16:39 Error TypeError: Cannot find type 'A'. */