diff --git a/ets2panda/ir/base/overloadDeclaration.h b/ets2panda/ir/base/overloadDeclaration.h index 667c653f8dc1decc1bf59b7f69315e8a4fc4b520..6ae479ca1b6251861bc6f0dcc2ad2c674efc6f0b 100644 --- a/ets2panda/ir/base/overloadDeclaration.h +++ b/ets2panda/ir/base/overloadDeclaration.h @@ -77,7 +77,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 0000000000000000000000000000000000000000..e1377d4065737e27a28e25db13a1a0671f6c2ed2 --- /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}; +} +