From 32245aa1a92f6b96919fcfd1ef787b58e4cf4efa Mon Sep 17 00:00:00 2001 From: yanpeng51 Date: Fri, 27 Jun 2025 16:00:17 +0800 Subject: [PATCH] "Supplemental override test" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Issue:[新需求]:https://gitee.com/openharmony/arkcompiler_ets_frontend/issues/ICIBFU Signed-off-by: yanpeng51 --- .../override_field_test.ets | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 ets2panda/test/runtime/ets/override_field_tests/override_field_test.ets diff --git a/ets2panda/test/runtime/ets/override_field_tests/override_field_test.ets b/ets2panda/test/runtime/ets/override_field_tests/override_field_test.ets new file mode 100644 index 0000000000..7a50e6476d --- /dev/null +++ b/ets2panda/test/runtime/ets/override_field_tests/override_field_test.ets @@ -0,0 +1,43 @@ +/* + * 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. + */ + +class Base1{ + field : number = this.init_in_base() + private init_in_base() { + return 123; + } +} + +interface Base2 { + field : number +} + +class Base3 extends Base1 { + override field: number = 345; +} + + +class Derived extends Base3 implements Base2 { + field:number = this.init_in_derived() + + private init_in_derived() { + return 456; + } +} + +function main() +{ + let derived = new Derived(); +} \ No newline at end of file -- Gitee