diff --git a/ets2panda/checker/ets/helpers.cpp b/ets2panda/checker/ets/helpers.cpp index 9cbdb705276c3778031bdbfe2876f3ad7fe192d7..aace2bbd4c8090f43d53102da3b498b6f89ca462 100644 --- a/ets2panda/checker/ets/helpers.cpp +++ b/ets2panda/checker/ets/helpers.cpp @@ -2792,6 +2792,13 @@ ir::ClassProperty *ETSChecker::ClassPropToImplementationProp(ir::ClassProperty * fieldDecl->BindNode(classProp); auto fieldVar = scope->InstanceFieldScope()->AddDecl(ProgramAllocator(), fieldDecl, ScriptExtension::ETS); + if (fieldVar == nullptr) { + VarBinder()->ThrowRedeclaration(classProp->Id()->Start(), fieldDecl->Name(), fieldDecl->Type()); + fieldVar = + scope->InstanceFieldScope()->FindLocal(fieldDecl->Name(), varbinder::ResolveBindingOptions::BINDINGS); + } + ES2PANDA_ASSERT(fieldVar != nullptr); + fieldVar->AddFlag(varbinder::VariableFlags::PROPERTY); fieldVar->SetScope(scope->InstanceFieldScope()); diff --git a/ets2panda/test/runtime/ets/fuzz/repeated_del.ets b/ets2panda/test/runtime/ets/fuzz/repeated_del.ets new file mode 100644 index 0000000000000000000000000000000000000000..bd847c3ef9dc43aafbcff58bf9b40fb590ea8aa0 --- /dev/null +++ b/ets2panda/test/runtime/ets/fuzz/repeated_del.ets @@ -0,0 +1,29 @@ +/* + * 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. + */ +/*--- + tags: [compile-only, negative] +---*/ +interface ReadonlySet { + set (: d) + get ‹(): b + + + } + + class Set implements ReadonlySet { + public ‹: *ERROR_TYPE*; + public : *ERROR_TYPE*; + } + \ No newline at end of file diff --git a/ets2panda/test/test-lists/declgenets2ts/ets-runtime/declgen-ets2ts-runtime-ignored.txt b/ets2panda/test/test-lists/declgenets2ts/ets-runtime/declgen-ets2ts-runtime-ignored.txt index 61fb015d81cbaf7adc057474ceba26b74d3af6ce..c1415efa88988c14fb1b407ee1ceb71cc67a8403 100644 --- a/ets2panda/test/test-lists/declgenets2ts/ets-runtime/declgen-ets2ts-runtime-ignored.txt +++ b/ets2panda/test/test-lists/declgenets2ts/ets-runtime/declgen-ets2ts-runtime-ignored.txt @@ -31,3 +31,4 @@ Multiline_string.ets Multiline_string_escape_char.ets async_lambda_return_type_test.ets fuzz/class_body_interface.ets +fuzz/repeated_del.ets diff --git a/ets2panda/test/test-lists/srcdumper/srcdumper-ets-ignored.txt b/ets2panda/test/test-lists/srcdumper/srcdumper-ets-ignored.txt index d83411312362773be86681c1023b31a55b3245f6..8239acc4110adbb8937d07b1f9357001c197b70d 100644 --- a/ets2panda/test/test-lists/srcdumper/srcdumper-ets-ignored.txt +++ b/ets2panda/test/test-lists/srcdumper/srcdumper-ets-ignored.txt @@ -55,6 +55,7 @@ runtime/ets/fuzz/too_many_left_square_brackets.ets runtime/ets/fuzz/too_many_new_expr.ets runtime/ets/fuzz/too_many_expression.ets runtime/ets/fuzz/class_body_interface.ets +runtime/ets/fuzz/repeated_del.ets ast/compiler/ets/DeclareIndexerTest.ets ast/parser/ets/import_tests/import_class_with_static_field/import_class_with_static_field.ets