diff --git a/ets2panda/parser/ETSparserTypes.cpp b/ets2panda/parser/ETSparserTypes.cpp index dc590faec018f73ce1255c61b370754742c15ed5..3ce635393bb58475a34f9eed9e47c0e6b4977742 100644 --- a/ets2panda/parser/ETSparserTypes.cpp +++ b/ets2panda/parser/ETSparserTypes.cpp @@ -460,6 +460,7 @@ ir::TypeNode *ETSParser::ParseThisType(TypeAnnotationParsingOptions *options) ir::TypeNode *ETSParser::ParseTsArrayType(ir::TypeNode *typeNode, TypeAnnotationParsingOptions *options) { + *options &= ~TypeAnnotationParsingOptions::ANNOTATION_NOT_ALLOW; while (Lexer()->GetToken().Type() == lexer::TokenType::PUNCTUATOR_LEFT_SQUARE_BRACKET) { if (((*options) & TypeAnnotationParsingOptions::POTENTIAL_NEW_ARRAY) != 0) { return typeNode; diff --git a/ets2panda/test/runtime/ets/annotation_tests/AnnotationForArray.ets b/ets2panda/test/runtime/ets/annotation_tests/AnnotationForArray.ets new file mode 100755 index 0000000000000000000000000000000000000000..56b8604f92b2d3b2d9742b6bf29a33893980ef5c --- /dev/null +++ b/ets2panda/test/runtime/ets/annotation_tests/AnnotationForArray.ets @@ -0,0 +1,19 @@ +/* + * 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. + */ + +@Retention("SOURCE") +@interface Anno{} + +let arr:(@Anno string)[]; \ No newline at end of file