From d225a02bae2159d2a6baf653ffea6bacf222400e Mon Sep 17 00:00:00 2001 From: oh-rgx Date: Mon, 30 Jun 2025 11:58:54 +0800 Subject: [PATCH] Fix CreatePartialType crash Issue: #ICIQHU Signed-off-by: oh-rgx --- ets2panda/checker/ets/utilityTypeHandlers.cpp | 2 +- .../test/ast/compiler/ets/unsupport_any.ets | 20 +++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 ets2panda/test/ast/compiler/ets/unsupport_any.ets diff --git a/ets2panda/checker/ets/utilityTypeHandlers.cpp b/ets2panda/checker/ets/utilityTypeHandlers.cpp index e893a1a951..883de6f6ed 100644 --- a/ets2panda/checker/ets/utilityTypeHandlers.cpp +++ b/ets2panda/checker/ets/utilityTypeHandlers.cpp @@ -121,7 +121,7 @@ Type *ETSChecker::CreatePartialType(Type *const typeToBePartial) { ES2PANDA_ASSERT(typeToBePartial->IsETSReferenceType()); - if (typeToBePartial->IsETSAnyType()) { + if (typeToBePartial->IsETSAnyType() || typeToBePartial->IsTypeError()) { return typeToBePartial; } diff --git a/ets2panda/test/ast/compiler/ets/unsupport_any.ets b/ets2panda/test/ast/compiler/ets/unsupport_any.ets new file mode 100644 index 0000000000..a15e30902a --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/unsupport_any.ets @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2024-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 assign>(sourtc: T, target: Partial) { + +} + +/* @@? 16:42 Error TypeError: Cannot find type 'any'. */ -- Gitee