diff --git a/ets2panda/parser/TypedParser.cpp b/ets2panda/parser/TypedParser.cpp index 23415ba83e8b85e49a6d5acb261b7dc088187893..a6ebafbfc7d73a84ff36e828b7c54ea514229c5b 100644 --- a/ets2panda/parser/TypedParser.cpp +++ b/ets2panda/parser/TypedParser.cpp @@ -241,7 +241,7 @@ ir::ArrowFunctionExpression *TypedParser::ParseGenericArrowFunction() ES2PANDA_ASSERT(Lexer()->GetToken().Type() == lexer::TokenType::PUNCTUATOR_LESS_THAN); lexer::SourcePosition startLoc = Lexer()->GetToken().Start(); - auto typeParamDeclOptions = TypeAnnotationParsingOptions::NO_OPTS; + auto typeParamDeclOptions = TypeAnnotationParsingOptions::REPORT_ERROR; ir::TSTypeParameterDeclaration *typeParamDecl = ParseTypeParameterDeclaration(&typeParamDeclOptions); if (Lexer()->GetToken().Type() != lexer::TokenType::PUNCTUATOR_LEFT_PARENTHESIS) { diff --git a/ets2panda/test/ast/compiler/ets/invalid_token.ets b/ets2panda/test/ast/compiler/ets/invalid_token.ets index e7e33126f8f6c3d6b5efdbe3e5f8a51aa8e96817..0d30da416f29ef79a62fb6ce05896035530a5498 100644 --- a/ets2panda/test/ast/compiler/ets/invalid_token.ets +++ b/ets2panda/test/ast/compiler/ets/invalid_token.ets @@ -19,4 +19,5 @@ class A { /* @@? 17:18 Error SyntaxError: Number, string or computed value property name '2' is not allowed, use classes to access data by property names that are identifiers */ /* @@? 17:18 Error SyntaxError: Identifier expected, got 'number literal'. */ -/* @@? 17:18 Error SyntaxError: Unexpected token '2'. */ \ No newline at end of file +/* @@? 17:18 Error SyntaxError: Unexpected token '2'. */ +/* @@? 18:1 Error SyntaxError: Unexpected token, expected '>'. */ diff --git a/ets2panda/test/ast/parser/ets/invalid_syntax_in_object_literal.ets b/ets2panda/test/ast/parser/ets/invalid_syntax_in_object_literal.ets new file mode 100644 index 0000000000000000000000000000000000000000..11b608f9bcec649f98413bc81fab1a948510360d --- /dev/null +++ b/ets2panda/test/ast/parser/ets/invalid_syntax_in_object_literal.ets @@ -0,0 +1,23 @@ +/* + * 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. + */ + +let a2: A2 = { + value: { + 'bbb': 222 / '. */