diff --git a/ets2panda/compiler/core/ETSCompiler.cpp b/ets2panda/compiler/core/ETSCompiler.cpp index f7d9c68b16b3b9eaa58a4a84bc5e20c59204f83f..23b067caa18625b85eb9e386c4989716f93385e8 100644 --- a/ets2panda/compiler/core/ETSCompiler.cpp +++ b/ets2panda/compiler/core/ETSCompiler.cpp @@ -971,7 +971,7 @@ void ETSCompiler::Compile(const ir::CallExpression *expr) const } else if (expr->Callee()->IsSuperExpression() || expr->Callee()->IsThisExpression()) { ASSERT(!isReference && expr->IsETSConstructorCall()); expr->Callee()->Compile(etsg); // ctor is not a value! - etsg->SetVRegType(calleeReg, etsg->GetAccumulatorType()); + etsg->StoreAccumulator(expr, calleeReg); EmitCall(expr, calleeReg, isStatic, signature, isReference); } else { ASSERT(isReference); diff --git a/ets2panda/test/runtime/ets/15766.ets b/ets2panda/test/runtime/ets/15766.ets new file mode 100644 index 0000000000000000000000000000000000000000..7ae5757c9376b53d84006ff015a490da3b080988 --- /dev/null +++ b/ets2panda/test/runtime/ets/15766.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2024 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. + */ + +class E { + constructor() {} +} + +class AE extends E { + constructor() { + super() + let a = 3; + } +} + +function main() : int +{ + let ae = new AE(); + return 0; +}