From 4b7fff0d10467524384dcd574afd1f6cc5b09184 Mon Sep 17 00:00:00 2001 From: xuxinjie4 Date: Sat, 6 Sep 2025 16:45:58 +0800 Subject: [PATCH] Fix overloadDeclaration.h Issue: https://gitee.com/openharmony/arkcompiler_ets_frontend/issues/ICWPIJ?from=project-issue Signed-off-by: xuxinjie4 --- ets2panda/ir/base/overloadDeclaration.h | 2 +- .../ets/overload/constructor_overload.ets | 21 +++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 ets2panda/test/ast/compiler/ets/overload/constructor_overload.ets diff --git a/ets2panda/ir/base/overloadDeclaration.h b/ets2panda/ir/base/overloadDeclaration.h index c84a1f7eea..5ee839850e 100644 --- a/ets2panda/ir/base/overloadDeclaration.h +++ b/ets2panda/ir/base/overloadDeclaration.h @@ -78,7 +78,7 @@ public: void PushFront(Identifier *const overloadedExpression) { auto newNode = GetOrCreateHistoryNodeAs(); - newNode->overloadedList_.insert(overloadedList_.begin(), overloadedExpression); + newNode->overloadedList_.insert(newNode->overloadedList_.begin(), overloadedExpression); } void AddOverloadDeclFlag(OverloadDeclFlags overloadFlag) diff --git a/ets2panda/test/ast/compiler/ets/overload/constructor_overload.ets b/ets2panda/test/ast/compiler/ets/overload/constructor_overload.ets new file mode 100644 index 0000000000..e1377d4065 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/overload/constructor_overload.ets @@ -0,0 +1,21 @@ +/* + * 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. + */ + +declare class Readable { + constructor(); + constructor fromOptions(); + overload constructor {fromOptions}; +} + -- Gitee