diff --git a/ets2panda/checker/ets/helpers.cpp b/ets2panda/checker/ets/helpers.cpp index 313c539f8257d04f9892e4a9076a387a11c857a2..7af150985bfcef9a75db2c5e25a3b34b52378ac8 100644 --- a/ets2panda/checker/ets/helpers.cpp +++ b/ets2panda/checker/ets/helpers.cpp @@ -2813,6 +2813,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 307994e6fe228656804630d1f115469f0e22e1fd..7668597d9d05f70c40f5590a7c593154f315a223 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 run_ok_without_semicolon.ets async_lambda_return_type_test.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 8eb1ec055c7b6e50099b7898f0aec3e25abcacab..da725344e8b96c92b2d4da3961516d7c53f4aca8 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_brace.ets runtime/ets/fuzz/too_many_left_square_brackets.ets runtime/ets/fuzz/too_many_new_expr.ets runtime/ets/fuzz/too_many_token.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