diff --git a/ets2panda/checker/ets/helpers.cpp b/ets2panda/checker/ets/helpers.cpp index 535a1adc4054046cf7763dad920e3ad694939845..18ca3848f1fe21bdfba588eca5d5035b523fd298 100644 --- a/ets2panda/checker/ets/helpers.cpp +++ b/ets2panda/checker/ets/helpers.cpp @@ -2922,12 +2922,13 @@ ir::ClassProperty *GetImplementationClassProp(ETSChecker *checker, ir::ClassProp return classProp; } - auto *const classProp = classType - ->GetProperty(interfaceProp->Key()->AsIdentifier()->Name(), - PropertySearchFlags::SEARCH_ALL | PropertySearchFlags::SEARCH_IN_BASE) - ->Declaration() - ->Node() - ->AsClassProperty(); + auto *const classProp = + classType + ->GetProperty(interfaceProp->Key()->AsIdentifier()->Name(), + PropertySearchFlags::SEARCH_INSTANCE_FIELD | PropertySearchFlags::SEARCH_IN_BASE) + ->Declaration() + ->Node() + ->AsClassProperty(); classProp->AddModifier(ir::ModifierFlags::SUPER_OWNER); return classProp; } diff --git a/ets2panda/test/runtime/ets/implement_interface.ets b/ets2panda/test/runtime/ets/implement_interface.ets new file mode 100644 index 0000000000000000000000000000000000000000..fbf11391da32fcc1b1af8309dfbbd015f3907f3a --- /dev/null +++ b/ets2panda/test/runtime/ets/implement_interface.ets @@ -0,0 +1,32 @@ +/* + * 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. + */ + +interface I { + i: number; +} + +class B { + i: number = 1; +} + +class C extends B implements I { + static i: number = 2; +} + +function main() { + let c = new C(); + arktest.assertEQ(c.i, 1); + arktest.assertEQ(C.i, 2); +} diff --git a/ets2panda/test/test-lists/recheck/recheck-ignored.txt b/ets2panda/test/test-lists/recheck/recheck-ignored.txt index b1dc9d23c2b9fd90abf7a12f5e3c7f26783a8940..59b03fc9848d1e8515413f49c97b930d037463e0 100644 --- a/ets2panda/test/test-lists/recheck/recheck-ignored.txt +++ b/ets2panda/test/test-lists/recheck/recheck-ignored.txt @@ -86,6 +86,7 @@ runtime/ets/lambda_with_receiver/lambda_with_receiver_trailing_in_function.ets runtime/ets/lambda_with_receiver/lambda_with_receiver_trailing_in_function_with_receiver.ets runtime/ets/lambda_with_receiver/lambda_with_receiver_trailing_name_duplicated.ets runtime/ets/generic_lambda_6.ets +runtime/ets/implement_interface.ets #Test that failed before CheckerPhase (on ConstantExpressionLowering) ast/parser/ets/InvalidLexer.ets #Test that failed with abort before plugins-after-check phase