diff --git a/ets2panda/checker/ets/helpers.cpp b/ets2panda/checker/ets/helpers.cpp index 553abd66e2047e601d4e4440b62db65fc8eadec5..10a0cfd60ab75fc7fb4d1d03094a096b8cd0236e 100644 --- a/ets2panda/checker/ets/helpers.cpp +++ b/ets2panda/checker/ets/helpers.cpp @@ -99,11 +99,13 @@ void ETSChecker::WrongContextErrorClassifyByType(ir::Identifier *ident) varbinder::VariableFlags::TYPE))) { case varbinder::VariableFlags::CLASS: identCategoryName = "Class"; - break; + LogError(diagnostic::NOT_AS_OBJECT, {identCategoryName}, ident->Start()); + return; case varbinder::VariableFlags::NAMESPACE: identCategoryName = "Namespace"; - break; + LogError(diagnostic::NOT_AS_OBJECT, {identCategoryName}, ident->Start()); + return; case varbinder::VariableFlags::METHOD: identCategoryName = "Function"; diff --git a/ets2panda/parser/ETSparser.cpp b/ets2panda/parser/ETSparser.cpp index 2a7ea152f1d0c42814411b6665fbd1e30fd2b4d0..09542e5e65f4bd1247a6289e08c7f10b3aaeb614 100644 --- a/ets2panda/parser/ETSparser.cpp +++ b/ets2panda/parser/ETSparser.cpp @@ -1630,6 +1630,16 @@ bool ETSParser::IsFixedArrayTypeNode(ir::AstNode *node) ir::Expression *ETSParser::ParseFunctionParameter() { + switch (Lexer()->GetToken().Type()) { + case lexer::TokenType::KEYW_PRIVATE: + case lexer::TokenType::KEYW_PUBLIC: + case lexer::TokenType::KEYW_PROTECTED: + LogError(diagnostic::FIELD_IN_PARAM); + Lexer()->NextToken(); + default: + break; + } + if (Lexer()->GetToken().Type() == lexer::TokenType::PUNCTUATOR_AT) { return ParseFunctionParameterAnnotations(); } diff --git a/ets2panda/parser/ETSparserExpressions.cpp b/ets2panda/parser/ETSparserExpressions.cpp index 7a0cb42540017e338534f2b12a247320c7db9296..bff2cbec61e8ca9a642255a35da2c38a699fa4e7 100644 --- a/ets2panda/parser/ETSparserExpressions.cpp +++ b/ets2panda/parser/ETSparserExpressions.cpp @@ -359,9 +359,13 @@ ir::Expression *ETSParser::ParsePrimaryExpression(ExpressionParseFlags flags) } case lexer::TokenType::KEYW_TYPE: { LogError(diagnostic::TYPE_ALIAS_ONLY_TOP_LEVEL); - const auto &rangeToken = Lexer()->GetToken().Loc(); ParseTypeAliasDeclaration(); // Try to parse type alias and drop the result. - return AllocBrokenExpression(rangeToken); + return AllocBrokenExpression(Lexer()->GetToken().Loc()); + } + case lexer::TokenType::KEYW_FUNCTION: { + LogError(diagnostic::FUNC_EXPR); + ParseFunctionDeclaration(true, ir::ModifierFlags::NONE); + return AllocBrokenExpression(Lexer()->GetToken().Loc()); } case lexer::TokenType::PUNCTUATOR_FORMAT: { return ParseExpressionFormatPlaceholder(); diff --git a/ets2panda/parser/parserImpl.cpp b/ets2panda/parser/parserImpl.cpp index ade0b8337b5d866c72581b70a5723e2543e37930..4f66296e627555da3127cf70f15b71aedd5f342d 100644 --- a/ets2panda/parser/parserImpl.cpp +++ b/ets2panda/parser/parserImpl.cpp @@ -1267,6 +1267,11 @@ ir::Identifier *ParserImpl::ExpectIdentifier([[maybe_unused]] bool isReference, if ((options & TypeAnnotationParsingOptions::REPORT_ERROR) == 0) { return nullptr; } + if (token.IsLiteral()) { + LogError(diagnostic::LITERAL_VALUE_IDENT, {token.ToString()}, tokenStart); + } else if (token.IsKeyword()) { + LogError(diagnostic::HARD_KEYWORD_IDENT, {token.ToString()}, tokenStart); + } LogError(diagnostic::IDENTIFIER_EXPECTED_HERE, {TokenToString(tokenType)}, tokenStart); lexer_->NextToken(); return AllocBrokenExpression(tokenStart); diff --git a/ets2panda/test/ast/compiler/ets/FixedArray/tuple_types_9_neg.ets b/ets2panda/test/ast/compiler/ets/FixedArray/tuple_types_9_neg.ets index 978f7ce86d5fdc1bfd4b0808bf27313bc64853ab..baddef4e13b7be0894b3837afa1b74bfe705e61c 100644 --- a/ets2panda/test/ast/compiler/ets/FixedArray/tuple_types_9_neg.ets +++ b/ets2panda/test/ast/compiler/ets/FixedArray/tuple_types_9_neg.ets @@ -24,6 +24,6 @@ function main(): void { /* @@? 18:40 Error SyntaxError: Unexpected token, expected ',' or ']'. */ /* @@? 18:40 Error SyntaxError: Unexpected token '>'. */ /* @@? 18:43 Error SyntaxError: Unexpected token 'Int'. */ -/* @@? 18:43 Error TypeError: Class name 'Int' used in the wrong context */ +/* @@? 18:43 Error SyntaxError: Class cannot be used as object. */ /* @@? 18:43 Error TypeError: Bad operand type, the types of the operands must be numeric, same enumeration, or boolean type. */ /* @@? 18:47 Error SyntaxError: Unexpected token ']'. */ diff --git a/ets2panda/test/ast/compiler/ets/import_tests/import_chain_with_errors/import_1.ets b/ets2panda/test/ast/compiler/ets/import_tests/import_chain_with_errors/import_1.ets index 22afeef200aa350613a29be5b9773a7fbae0e044..fbf91a5f6d272d0dcd6f0843c43bd9be41dab74e 100644 --- a/ets2panda/test/ast/compiler/ets/import_tests/import_chain_with_errors/import_1.ets +++ b/ets2panda/test/ast/compiler/ets/import_tests/import_chain_with_errors/import_1.ets @@ -26,6 +26,7 @@ let 1: number // First level import with both types of error /* @@? import_1.ets:21:17 Error TypeError: Type 'Int' cannot be assigned to type 'String' */ /* @@? import_1.ets:24:5 Error SyntaxError: Identifier expected, got 'number literal'. */ +/* @@? import_1.ets:24:5 Error SyntaxError: Number, string or computed value property name '1' is not allowed, use classes to access data by property names that are identifiers */ // Second level import import with both types of error /* @@? import_2.ets:17:17 Error TypeError: Type 'Int' cannot be assigned to type 'String' */ diff --git a/ets2panda/test/ast/compiler/ets/import_tests/import_chain_with_errors/master_file.ets b/ets2panda/test/ast/compiler/ets/import_tests/import_chain_with_errors/master_file.ets index fd416a1cde80ffd6742865bda47925955662a0ff..c7b79fc31dc88b8dd9c755538d3f57985f899b0f 100644 --- a/ets2panda/test/ast/compiler/ets/import_tests/import_chain_with_errors/master_file.ets +++ b/ets2panda/test/ast/compiler/ets/import_tests/import_chain_with_errors/master_file.ets @@ -20,6 +20,7 @@ let b = new B(10); // First level import with both types of error /* @@? import_1.ets:21:17 Error TypeError: Type 'Int' cannot be assigned to type 'String' */ /* @@? import_1.ets:24:5 Error SyntaxError: Identifier expected, got 'number literal'. */ +/* @@? import_1.ets:24:5 Error SyntaxError: Number, string or computed value property name '1' is not allowed, use classes to access data by property names that are identifiers */ // Second level import import with both types of error /* @@? import_2.ets:17:17 Error TypeError: Type 'Int' cannot be assigned to type 'String' */ diff --git a/ets2panda/test/ast/compiler/ets/invalid_two_functions.ets b/ets2panda/test/ast/compiler/ets/invalid_two_functions.ets index 62d52f75f5cb2155a2d76209841e60a88aca9c41..f4850751e54e1f9d72894560bd436e6a932569d9 100644 --- a/ets2panda/test/ast/compiler/ets/invalid_two_functions.ets +++ b/ets2panda/test/ast/compiler/ets/invalid_two_functions.ets @@ -20,5 +20,6 @@ const b = a.map(function (e) { return e * 2; }); -/* @@? 16:2 Error SyntaxError: Unexpected token 'function'. */ -/* @@? 19:17 Error SyntaxError: Unexpected token 'function'. */ +/* @@? 16:2 Error SyntaxError: Function expressions are not supported, use arrow functions instead */ +/* @@? 19:17 Error SyntaxError: Function expressions are not supported, use arrow functions instead */ +/* @@? 19:28 Error SyntaxError: Parameter declaration should have an explicit type annotation. */ diff --git a/ets2panda/test/ast/compiler/ets/math_const_as_identifier.ets b/ets2panda/test/ast/compiler/ets/math_const_as_identifier.ets index 731f743e07e8ff1b9e3f6cbc36eee4dfb10be4d5..ef222fcc9f772058479b15c4bb03e777c2d78d67 100644 --- a/ets2panda/test/ast/compiler/ets/math_const_as_identifier.ets +++ b/ets2panda/test/ast/compiler/ets/math_const_as_identifier.ets @@ -26,5 +26,6 @@ function foo1() { /* @@? 21:9 Error TypeError: Variable 'NaN' has already been declared. */ /* @@? 22:9 Error TypeError: Variable 'Infinity' has already been declared. */ /* @@? 22:20 Error TypeError: Unresolved reference test */ +/* @@? 23:9 Error SyntaxError: Hard keyword 'undefined' cannot be used as identifier */ /* @@? 23:9 Error SyntaxError: Identifier expected, got 'undefined'. */ /* @@? 24:1 Error SyntaxError: Variable must be initialized or it's type must be declared. */ diff --git a/ets2panda/test/ast/compiler/ets/namespace_tests/namespace_as_type11.ets b/ets2panda/test/ast/compiler/ets/namespace_tests/namespace_as_type11.ets index b9f5b38405f8671f4c91af084fa7f3298efd7396..eb120df6c800b66d7b563804f51d40b13b6b4ec7 100644 --- a/ets2panda/test/ast/compiler/ets/namespace_tests/namespace_as_type11.ets +++ b/ets2panda/test/ast/compiler/ets/namespace_tests/namespace_as_type11.ets @@ -18,4 +18,4 @@ namespace MySpace { let a = /* @@ label */MySpace -/* @@@ label Error TypeError: Namespace name 'MySpace' used in the wrong context */ +/* @@@ label Error SyntaxError: Namespace cannot be used as object. */ diff --git a/ets2panda/test/ast/compiler/ets/static_index_function1.ets b/ets2panda/test/ast/compiler/ets/static_index_function1.ets index a341c997c9b417632509952ffa3a6ed8e389b954..36c1a7ebd551ea117a3c9dfddb806c4a3aad9ba0 100644 --- a/ets2panda/test/ast/compiler/ets/static_index_function1.ets +++ b/ets2panda/test/ast/compiler/ets/static_index_function1.ets @@ -29,5 +29,5 @@ function main() { /* @@@ label Error TypeError: '$_get' is a static property of 'A' */ /* @@@ label1 Error TypeError: '$_get' is a static property of 'A' */ -/* @@@ label2 Error TypeError: Class name 'A' used in the wrong context */ +/* @@@ label2 Error SyntaxError: Class cannot be used as object. */ /* @@@ label3 Error TypeError: '$_get' is a static property of 'A' */ diff --git a/ets2panda/test/ast/compiler/ets/static_index_function2.ets b/ets2panda/test/ast/compiler/ets/static_index_function2.ets index 9659ccec5293ce7a09fafb82e05ed1dff5c5231c..c6ae1e214f8ca52e2e8482918f9a36c7aea8f192 100644 --- a/ets2panda/test/ast/compiler/ets/static_index_function2.ets +++ b/ets2panda/test/ast/compiler/ets/static_index_function2.ets @@ -27,5 +27,5 @@ function main(): int { } /* @@@ label Error TypeError: '$_set' is a static property of 'A' */ -/* @@@ label1 Error TypeError: Class name 'A' used in the wrong context */ +/* @@@ label1 Error SyntaxError: Class cannot be used as object. */ /* @@@ label2 Error TypeError: '$_set' is a static property of 'A' */ diff --git a/ets2panda/test/ast/compiler/ets/type_error_processing/not_constructible_types.ets b/ets2panda/test/ast/compiler/ets/type_error_processing/not_constructible_types.ets index 05eb89b3ebd56f196cad0dda0f033f5582055905..4341a3928cf2a97ebbc724a072faf3bf72b0f1bc 100644 --- a/ets2panda/test/ast/compiler/ets/type_error_processing/not_constructible_types.ets +++ b/ets2panda/test/ast/compiler/ets/type_error_processing/not_constructible_types.ets @@ -35,5 +35,5 @@ WeakSet [12] = new undefined() /* @@? 20:1 Error TypeError: This expression is not constructible. */ /* @@? 23:1 Error TypeError: The union type is not constructible. */ /* @@? 26:1 Error TypeError: Indexed signatures are not allowed. Use arrays instead! */ -/* @@? 26:1 Error TypeError: Class name 'WeakSet' used in the wrong context */ +/* @@? 26:1 Error SyntaxError: Class cannot be used as object. */ /* @@? 26:16 Error TypeError: Type 'undefined' is not constructible. */ diff --git a/ets2panda/test/ast/parser/ets/FixedArray/MultipleParserErrors.ets b/ets2panda/test/ast/parser/ets/FixedArray/MultipleParserErrors.ets index eead0041009ec11fcdf07db40a84b435c7a8afd2..bfd2a41f7ce970122601da20883d86c0f4cf65ea 100644 --- a/ets2panda/test/ast/parser/ets/FixedArray/MultipleParserErrors.ets +++ b/ets2panda/test/ast/parser/ets/FixedArray/MultipleParserErrors.ets @@ -275,10 +275,13 @@ function main(): void { /* @@? 157:16 Error TypeError: A is abstract therefore cannot be instantiated. */ /* @@? 158:26 Error TypeError: Property 'getInner' does not exist on type 'A' */ /* @@? 161:9 Error SyntaxError: Identifier expected, got 'let'. */ +/* @@? 161:9 Error SyntaxError: Hard keyword 'let' cannot be used as identifier */ +/* @@? 162:9 Error SyntaxError: Hard keyword 'const' cannot be used as identifier */ /* @@? 162:9 Error SyntaxError: Identifier expected, got 'const'. */ /* @@? 163:9 Error SyntaxError: Identifier expected, got 'new'. */ +/* @@? 163:9 Error SyntaxError: Hard keyword 'new' cannot be used as identifier */ /* @@? 164:5 Error TypeError: This expression is not callable. */ /* @@? 165:5 Error TypeError: This expression is not callable. */ /* @@? 166:5 Error TypeError: Expected 1 arguments, got 0. */ /* @@? 166:5 Error TypeError: No matching call signature */ -/* @@? 285:1 Error SyntaxError: Expected '}', got 'end of stream'. */ +/* @@? 288:1 Error SyntaxError: Expected '}', got 'end of stream'. */ diff --git a/ets2panda/test/ast/parser/ets/InvalidParserImpl.ets b/ets2panda/test/ast/parser/ets/InvalidParserImpl.ets index f1a1bac9355051e04eba42620f38d97b2d736581..feca6d13fffc6c08f84198aede31717936a7c022 100644 --- a/ets2panda/test/ast/parser/ets/InvalidParserImpl.ets +++ b/ets2panda/test/ast/parser/ets/InvalidParserImpl.ets @@ -26,4 +26,5 @@ class int {} /* @@? 18:5 Error SyntaxError: Getter must not have formal parameters. */ /* @@? 19:1 Error SyntaxError: Setter must have exactly one formal parameter. */ /* @@? 23:7 Error SyntaxError: Cannot be used as user-defined type. */ +/* @@? 23:7 Error SyntaxError: Hard keyword 'int' cannot be used as identifier */ /* @@? 23:7 Error SyntaxError: Identifier expected, got 'int'. */ diff --git a/ets2panda/test/ast/parser/ets/MultipleClassErrors.ets b/ets2panda/test/ast/parser/ets/MultipleClassErrors.ets index 216d6b70d7b2dee478c3ec8277c041f4640c888f..2eca08c7dc33c5f4079a4225bb99c53eb59c3b70 100644 --- a/ets2panda/test/ast/parser/ets/MultipleClassErrors.ets +++ b/ets2panda/test/ast/parser/ets/MultipleClassErrors.ets @@ -33,7 +33,8 @@ class /* @@ label4 */{/* @@ label5 */} /* @@? 21:20 Error SyntaxError: Unexpected token 'let'. */ /* @@? 22:20 Error SyntaxError: Unexpected token 'let'. */ /* @@? 24:17 Error TypeError: Type '"abc"' cannot be assigned to type 'Double' */ +/* @@? 28:22 Error SyntaxError: Number, string or computed value property name '77' is not allowed, use classes to access data by property names that are identifiers */ /* @@? 28:22 Error SyntaxError: Identifier expected, got 'number literal'. */ /* @@? 30:22 Error SyntaxError: Identifier expected, got '{'. */ /* @@? 30:38 Error SyntaxError: Expected '{', got '}'. */ -/* @@? 40:1 Error SyntaxError: Expected '}', got 'end of stream'. */ +/* @@? 41:1 Error SyntaxError: Expected '}', got 'end of stream'. */ diff --git a/ets2panda/test/ast/parser/ets/MultipleParserErrors.ets b/ets2panda/test/ast/parser/ets/MultipleParserErrors.ets index 9358e02dd9d825070607791c55111ab1dbad8b73..f90392bf9397c420ff47cec0efefe2482686bb13 100644 --- a/ets2panda/test/ast/parser/ets/MultipleParserErrors.ets +++ b/ets2panda/test/ast/parser/ets/MultipleParserErrors.ets @@ -273,10 +273,13 @@ function main(): void { /* @@? 157:16 Error TypeError: A is abstract therefore cannot be instantiated. */ /* @@? 158:26 Error TypeError: Property 'getInner' does not exist on type 'A' */ /* @@? 161:9 Error SyntaxError: Identifier expected, got 'let'. */ +/* @@? 161:9 Error SyntaxError: Hard keyword 'let' cannot be used as identifier */ +/* @@? 162:9 Error SyntaxError: Hard keyword 'const' cannot be used as identifier */ /* @@? 162:9 Error SyntaxError: Identifier expected, got 'const'. */ +/* @@? 163:9 Error SyntaxError: Hard keyword 'new' cannot be used as identifier */ /* @@? 163:9 Error SyntaxError: Identifier expected, got 'new'. */ /* @@? 164:5 Error TypeError: This expression is not callable. */ /* @@? 165:5 Error TypeError: This expression is not callable. */ /* @@? 166:5 Error TypeError: Expected 1 arguments, got 0. */ /* @@? 166:5 Error TypeError: No matching call signature */ -/* @@? 283:1 Error SyntaxError: Expected '}', got 'end of stream'. */ +/* @@? 286:1 Error SyntaxError: Expected '}', got 'end of stream'. */ diff --git a/ets2panda/test/ast/parser/ets/annotations_tests/annotationDecl_bad_initializer01.ets b/ets2panda/test/ast/parser/ets/annotations_tests/annotationDecl_bad_initializer01.ets index c91e54e8e1546c2aa440ca29bec14288070dc0b2..1c44ded6935e22953442f74a0911854b7eed7949 100644 --- a/ets2panda/test/ast/parser/ets/annotations_tests/annotationDecl_bad_initializer01.ets +++ b/ets2panda/test/ast/parser/ets/annotations_tests/annotationDecl_bad_initializer01.ets @@ -20,6 +20,6 @@ class A{} } -/* @@@ label Error TypeError: Class name 'A' used in the wrong context */ +/* @@@ label Error SyntaxError: Class cannot be used as object. */ /* @@@ label Error TypeError: Type 'A' cannot be assigned to type 'String' */ /* @@@ label Error TypeError: Invalid value for annotation field, expected a constant literal. */ diff --git a/ets2panda/test/ast/parser/ets/annotations_tests/annotationDecl_with_innerclass.ets b/ets2panda/test/ast/parser/ets/annotations_tests/annotationDecl_with_innerclass.ets index 79ef906623e292c7f02b97ce1b33d93ca70c8cf0..02ed066c23bdfeb9d4be5ee5db49ca8d92d3b83f 100644 --- a/ets2panda/test/ast/parser/ets/annotations_tests/annotationDecl_with_innerclass.ets +++ b/ets2panda/test/ast/parser/ets/annotations_tests/annotationDecl_with_innerclass.ets @@ -17,6 +17,7 @@ class A{} } +/* @@? 17:5 Error SyntaxError: Hard keyword 'class' cannot be used as identifier */ /* @@? 17:5 Error SyntaxError: Identifier expected, got 'class'. */ /* @@? 17:12 Error SyntaxError: Missing type annotation for property 'A'. */ /* @@? 17:12 Error SyntaxError: Identifier expected, got '{'. */ diff --git a/ets2panda/test/ast/parser/ets/annotations_tests/annotationUsage_bad_param01.ets b/ets2panda/test/ast/parser/ets/annotations_tests/annotationUsage_bad_param01.ets index 291e9fc476b02b5d03e0c415a0f5c32b63d79253..2fb3feaa785b30cd97c365acd222dcee03a80d01 100644 --- a/ets2panda/test/ast/parser/ets/annotations_tests/annotationUsage_bad_param01.ets +++ b/ets2panda/test/ast/parser/ets/annotations_tests/annotationUsage_bad_param01.ets @@ -23,6 +23,6 @@ class A{} class B{} -/* @@@ label Error TypeError: Class name 'A' used in the wrong context */ +/* @@@ label Error SyntaxError: Class cannot be used as object. */ /* @@@ label Error TypeError: Type 'A' cannot be assigned to type 'String' */ /* @@@ label Error TypeError: Invalid value for annotation field, expected a constant literal. */ diff --git a/ets2panda/test/ast/parser/ets/annotations_tests/annotationUsage_bad_param_for_classproperty.ets b/ets2panda/test/ast/parser/ets/annotations_tests/annotationUsage_bad_param_for_classproperty.ets index 6bda66d08940770a04e4aba7da07a38063a7dfc2..389af848c79f2620d8032f0262f11c897692c21a 100644 --- a/ets2panda/test/ast/parser/ets/annotations_tests/annotationUsage_bad_param_for_classproperty.ets +++ b/ets2panda/test/ast/parser/ets/annotations_tests/annotationUsage_bad_param_for_classproperty.ets @@ -28,9 +28,9 @@ class B{ } -/* @@@ label1 Error TypeError: Class name 'A' used in the wrong context */ +/* @@@ label1 Error SyntaxError: Class cannot be used as object. */ /* @@@ label1 Error TypeError: Type 'A' cannot be assigned to type 'String' */ /* @@@ label1 Error TypeError: Invalid value for annotation field, expected a constant literal. */ -/* @@@ label2 Error TypeError: Class name 'A' used in the wrong context */ +/* @@@ label2 Error SyntaxError: Class cannot be used as object. */ /* @@@ label2 Error TypeError: Type 'A' cannot be assigned to type 'String' */ /* @@@ label2 Error TypeError: Invalid value for annotation field, expected a constant literal. */ diff --git a/ets2panda/test/ast/parser/ets/annotations_tests/annotationUsage_bad_param_for_function_param.ets b/ets2panda/test/ast/parser/ets/annotations_tests/annotationUsage_bad_param_for_function_param.ets index 4b9930aa0d222eb5214dcade67a4db552f1c4cfc..cf347df6c7611ddf4a4c5bcee21246e4c4e21a2f 100644 --- a/ets2panda/test/ast/parser/ets/annotations_tests/annotationUsage_bad_param_for_function_param.ets +++ b/ets2panda/test/ast/parser/ets/annotations_tests/annotationUsage_bad_param_for_function_param.ets @@ -23,6 +23,6 @@ class A{} function foo(@MyAnno({testProperty1: /* @@ label */A}) x: int) { } -/* @@@ label Error TypeError: Class name 'A' used in the wrong context */ +/* @@@ label Error SyntaxError: Class cannot be used as object. */ /* @@@ label Error TypeError: Type 'A' cannot be assigned to type 'String' */ /* @@@ label Error TypeError: Invalid value for annotation field, expected a constant literal. */ diff --git a/ets2panda/test/ast/parser/ets/annotations_tests/annotationUsage_bad_param_for_global_variable_decl.ets b/ets2panda/test/ast/parser/ets/annotations_tests/annotationUsage_bad_param_for_global_variable_decl.ets index 42cc5b89bb8b5bda80e4639bcdcd232d948fed20..535b365f32749b2966664b57af09b1d91fa69913 100644 --- a/ets2panda/test/ast/parser/ets/annotations_tests/annotationUsage_bad_param_for_global_variable_decl.ets +++ b/ets2panda/test/ast/parser/ets/annotations_tests/annotationUsage_bad_param_for_global_variable_decl.ets @@ -24,6 +24,6 @@ class A{} let x = "abc" -/* @@@ label Error TypeError: Class name 'A' used in the wrong context */ +/* @@@ label Error SyntaxError: Class cannot be used as object. */ /* @@@ label Error TypeError: Type 'A' cannot be assigned to type 'String' */ /* @@@ label Error TypeError: Invalid value for annotation field, expected a constant literal. */ diff --git a/ets2panda/test/ast/parser/ets/annotations_tests/annotationUsage_bad_param_for_interface.ets b/ets2panda/test/ast/parser/ets/annotations_tests/annotationUsage_bad_param_for_interface.ets index b05a133e46f00d369cb474906c343f83d30a8e32..d544f882f733615ca8a40d5147dca8378cbd237b 100644 --- a/ets2panda/test/ast/parser/ets/annotations_tests/annotationUsage_bad_param_for_interface.ets +++ b/ets2panda/test/ast/parser/ets/annotations_tests/annotationUsage_bad_param_for_interface.ets @@ -25,6 +25,6 @@ interface itf { foo() : string } -/* @@@ label Error TypeError: Class name 'A' used in the wrong context */ +/* @@@ label Error SyntaxError: Class cannot be used as object. */ /* @@@ label Error TypeError: Type 'A' cannot be assigned to type 'String' */ /* @@@ label Error TypeError: Invalid value for annotation field, expected a constant literal. */ diff --git a/ets2panda/test/ast/parser/ets/annotations_tests/annotationUsage_bad_param_for_interfacemethod.ets b/ets2panda/test/ast/parser/ets/annotations_tests/annotationUsage_bad_param_for_interfacemethod.ets index 1dc2531c2f20d0531331bbd39a205d2dc142b6a7..ae609bf8f8e979ea73aa697849a7690cbb5ea1d7 100644 --- a/ets2panda/test/ast/parser/ets/annotations_tests/annotationUsage_bad_param_for_interfacemethod.ets +++ b/ets2panda/test/ast/parser/ets/annotations_tests/annotationUsage_bad_param_for_interfacemethod.ets @@ -25,6 +25,6 @@ interface itf { } -/* @@@ label Error TypeError: Class name 'A' used in the wrong context */ +/* @@@ label Error SyntaxError: Class cannot be used as object. */ /* @@@ label Error TypeError: Type 'A' cannot be assigned to type 'String' */ /* @@@ label Error TypeError: Invalid value for annotation field, expected a constant literal. */ diff --git a/ets2panda/test/ast/parser/ets/annotations_tests/annotationUsage_bad_param_for_interfaceproperty.ets b/ets2panda/test/ast/parser/ets/annotations_tests/annotationUsage_bad_param_for_interfaceproperty.ets index 87ea5db60576f9067c9ff478d31f58bff3a0cd47..4ce655dabf0b46248667309f22d432a25226c175 100644 --- a/ets2panda/test/ast/parser/ets/annotations_tests/annotationUsage_bad_param_for_interfaceproperty.ets +++ b/ets2panda/test/ast/parser/ets/annotations_tests/annotationUsage_bad_param_for_interfaceproperty.ets @@ -25,6 +25,6 @@ interface itf { } -/* @@@ label Error TypeError: Class name 'A' used in the wrong context */ +/* @@@ label Error SyntaxError: Class cannot be used as object. */ /* @@@ label Error TypeError: Type 'A' cannot be assigned to type 'String' */ /* @@@ label Error TypeError: Invalid value for annotation field, expected a constant literal. */ diff --git a/ets2panda/test/ast/parser/ets/annotations_tests/annotationUsage_bad_param_for_local_variable_decl.ets b/ets2panda/test/ast/parser/ets/annotations_tests/annotationUsage_bad_param_for_local_variable_decl.ets index bcb548094fdb7a8e0199987cbb6fc293ef37d14f..9c65ff8922fa6cfa80a0326c5990a7912e1a0b45 100644 --- a/ets2panda/test/ast/parser/ets/annotations_tests/annotationUsage_bad_param_for_local_variable_decl.ets +++ b/ets2panda/test/ast/parser/ets/annotations_tests/annotationUsage_bad_param_for_local_variable_decl.ets @@ -26,6 +26,6 @@ function main():void { } -/* @@@ label Error TypeError: Class name 'A' used in the wrong context */ +/* @@@ label Error SyntaxError: Class cannot be used as object. */ /* @@@ label Error TypeError: Type 'A' cannot be assigned to type 'String' */ /* @@@ label Error TypeError: Invalid value for annotation field, expected a constant literal. */ diff --git a/ets2panda/test/ast/parser/ets/annotations_tests/annotationUsage_bad_param_for_type_alias.ets b/ets2panda/test/ast/parser/ets/annotations_tests/annotationUsage_bad_param_for_type_alias.ets index 20828eff75c8e3514fe48652e3652bc4cb590e23..9eb2aa1f063285fe0409101e42c3faf7059a6d43 100644 --- a/ets2panda/test/ast/parser/ets/annotations_tests/annotationUsage_bad_param_for_type_alias.ets +++ b/ets2panda/test/ast/parser/ets/annotations_tests/annotationUsage_bad_param_for_type_alias.ets @@ -29,9 +29,9 @@ function main(): void { } -/* @@@ label1 Error TypeError: Class name 'A' used in the wrong context */ +/* @@@ label1 Error SyntaxError: Class cannot be used as object. */ /* @@@ label1 Error TypeError: Type 'A' cannot be assigned to type 'String' */ /* @@@ label1 Error TypeError: Invalid value for annotation field, expected a constant literal. */ -/* @@@ label2 Error TypeError: Class name 'A' used in the wrong context */ +/* @@@ label2 Error SyntaxError: Class cannot be used as object. */ /* @@@ label2 Error TypeError: Type 'A' cannot be assigned to type 'String' */ /* @@@ label2 Error TypeError: Invalid value for annotation field, expected a constant literal. */ diff --git a/ets2panda/test/ast/parser/ets/async_function_bad.ets b/ets2panda/test/ast/parser/ets/async_function_bad.ets index 6b628497f9291e4a57ff00c489c763c7a5fbf594..b55c2ffaf805c847953bbbdc5b6a313d38d8bde5 100644 --- a/ets2panda/test/ast/parser/ets/async_function_bad.ets +++ b/ets2panda/test/ast/parser/ets/async_function_bad.ets @@ -25,4 +25,4 @@ async native function foo(): Promise; /* @@? 16:27 Error SyntaxError: Unexpected token ')'. */ /* @@? 16:28 Error SyntaxError: Unexpected token, expected ')'. */ /* @@? 16:30 Error SyntaxError: Unexpected token 'Promise'. */ -/* @@? 16:30 Error TypeError: Class name 'Promise' used in the wrong context */ +/* @@? 16:30 Error SyntaxError: Class cannot be used as object. */ diff --git a/ets2panda/test/ast/parser/ets/decl_in_param.ets b/ets2panda/test/ast/parser/ets/decl_in_param.ets new file mode 100644 index 0000000000000000000000000000000000000000..39e7ac9b8f22cb6f5796d6ff0e57cd8a085c4823 --- /dev/null +++ b/ets2panda/test/ast/parser/ets/decl_in_param.ets @@ -0,0 +1,24 @@ +/* + * 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. + */ + +function f(public x: number){ +} +class C{ + constructor(public m:number) {} + m(public x:number) {} +} +/* @@? 16:12 Error SyntaxError: Declaring fields in parameter list is not supported */ +/* @@? 19:17 Error SyntaxError: Declaring fields in parameter list is not supported */ +/* @@? 20:7 Error SyntaxError: Declaring fields in parameter list is not supported */ diff --git a/ets2panda/test/ast/parser/ets/empty_array_map_inference_fail.ets b/ets2panda/test/ast/parser/ets/empty_array_map_inference_fail.ets index 0d648f4ea72508aa1f13ee99f58bafac51877434..e085a3efaffb4ed91f7fcca39ce993d05794b0f6 100644 --- a/ets2panda/test/ast/parser/ets/empty_array_map_inference_fail.ets +++ b/ets2panda/test/ast/parser/ets/empty_array_map_inference_fail.ets @@ -21,6 +21,7 @@ return x+1; }); -/* @@? 16:2 Error SyntaxError: Unexpected token 'function'. */ +/* @@? 16:2 Error SyntaxError: Function expressions are not supported, use arrow functions instead */ /* @@? 20:1 Error TypeError: Can't resolve array type */ -/* @@? 20:8 Error SyntaxError: Unexpected token 'function'. */ +/* @@? 20:8 Error SyntaxError: Function expressions are not supported, use arrow functions instead */ +/* @@? 20:18 Error SyntaxError: Parameter declaration should have an explicit type annotation. */ diff --git a/ets2panda/test/ast/parser/ets/interface_parser_error_1.ets b/ets2panda/test/ast/parser/ets/interface_parser_error_1.ets index afa196d8f38516aa48a779213330e93a323eb240..05540be90decdb67f05112134428cda9dd1abc45 100644 --- a/ets2panda/test/ast/parser/ets/interface_parser_error_1.ets +++ b/ets2panda/test/ast/parser/ets/interface_parser_error_1.ets @@ -59,9 +59,10 @@ function mdin() { let a = new A(); /* @@? 26:19 Error SyntaxError: Unexpected token, expected an identifier. */ /* @@? 27:5 Error SyntaxError: Unexpected token 'A'. */ /* @@? 27:7 Error SyntaxError: Unexpected token '{'. */ +/* @@? 28:5 Error SyntaxError: Hard keyword 'constructor' cannot be used as identifier */ /* @@? 28:5 Error SyntaxError: Identifier expected, got 'constructor'. */ /* @@? 28:19 Error SyntaxError: Annotations are not allowed on this type of declaration. */ /* @@? 29:18 Error SyntaxError: Unexpected token, expected an identifier. */ /* @@? 31:2 Error SyntaxError: Unexpected token '*'. */ /* @@? 32:1 Error SyntaxError: Nested functions are not allowed. */ -/* @@? 68:1 Error SyntaxError: Expected '}', got 'end of stream'. */ +/* @@? 69:1 Error SyntaxError: Expected '}', got 'end of stream'. */ diff --git a/ets2panda/test/ast/parser/ets/overloaded_method_as_value_neg.ets b/ets2panda/test/ast/parser/ets/overloaded_method_as_value_neg.ets index 2624a849c2912e8b25be517103e94b26e3d1e5c3..1f80043685998b862aae7445b7088d1bb1512c28 100644 --- a/ets2panda/test/ast/parser/ets/overloaded_method_as_value_neg.ets +++ b/ets2panda/test/ast/parser/ets/overloaded_method_as_value_neg.ets @@ -13,16 +13,17 @@ * limitations under the License. */ -interface"actual : " + actual.result[i] +interface"actual : " + actual.result[i] +/* @@? 16:10 Error SyntaxError: Number, string or computed value property name 'actual : ' is not allowed, use classes to access data by property names that are identifiers */ /* @@? 16:10 Error SyntaxError: Identifier expected, got 'string literal'. */ -/* @@? 16:23 Error SyntaxError: Unexpected token, expected '{'. */ -/* @@? 16:31 Error SyntaxError: Interface fields must have type annotation. */ -/* @@? 16:39 Error SyntaxError: Unexpected token, expected ']'. */ +/* @@? 16:22 Error SyntaxError: Unexpected token, expected '{'. */ +/* @@? 16:30 Error SyntaxError: Interface fields must have type annotation. */ +/* @@? 16:38 Error SyntaxError: Unexpected token, expected ']'. */ +/* @@? 16:38 Error SyntaxError: Unexpected token, expected ','. */ +/* @@? 16:38 Error SyntaxError: Unexpected token, expected 'private' or identifier. */ +/* @@? 16:39 Error SyntaxError: Identifier expected. */ /* @@? 16:39 Error SyntaxError: Unexpected token, expected ','. */ /* @@? 16:39 Error SyntaxError: Unexpected token, expected 'private' or identifier. */ -/* @@? 16:40 Error SyntaxError: Identifier expected. */ -/* @@? 16:40 Error SyntaxError: Unexpected token, expected ','. */ -/* @@? 16:40 Error SyntaxError: Unexpected token, expected 'private' or identifier. */ -/* @@? 28:67 Error SyntaxError: Identifier expected. */ -/* @@? 28:67 Error SyntaxError: Unexpected token, expected '}'. */ \ No newline at end of file +/* @@? 30:1 Error SyntaxError: Identifier expected. */ +/* @@? 30:1 Error SyntaxError: Unexpected token, expected '}'. */ diff --git a/ets2panda/test/ast/parser/ets/type_references.ets b/ets2panda/test/ast/parser/ets/type_references.ets index b689bb2c97d77d04ebab704d607253525626d531..a5db99d97c59ca2ae43d7fdb141ac2ab237c1c14 100644 --- a/ets2panda/test/ast/parser/ets/type_references.ets +++ b/ets2panda/test/ast/parser/ets/type_references.ets @@ -25,7 +25,7 @@ let y: G<{a:String}, B> // Error /* @@? 19:10 Error SyntaxError: Unexpected token '>'. */ /* @@? 19:11 Error SyntaxError: Unexpected token 'a'. */ /* @@? 19:13 Error SyntaxError: Label must be followed by a loop statement. */ -/* @@? 19:13 Error TypeError: Class name 'String' used in the wrong context */ +/* @@? 19:13 Error SyntaxError: Class cannot be used as object. */ /* @@? 19:19 Error SyntaxError: Unexpected token '}'. */ /* @@? 19:20 Error SyntaxError: Unexpected token ','. */ /* @@? 19:22 Error SyntaxError: Unexpected token 'B'. */ diff --git a/ets2panda/test/ast/parser/ets/unexpected_token_62.ets b/ets2panda/test/ast/parser/ets/unexpected_token_62.ets index b397c9a783511136231c99cfda73e3cb029b229a..78b6905b98b63eab7f505d42823d74c880bd42c7 100644 --- a/ets2panda/test/ast/parser/ets/unexpected_token_62.ets +++ b/ets2panda/test/ast/parser/ets/unexpected_token_62.ets @@ -34,7 +34,7 @@ int = 10 /* @@? 20:1 Error SyntaxError: Unexpected token, expected an identifier. */ /* @@? 20:1 Error TypeError: Unresolved reference nt */ /* @@? 20:10 Error SyntaxError: Unexpected token 'A'. */ -/* @@? 20:10 Error TypeError: Class name 'A' used in the wrong context */ +/* @@? 20:10 Error SyntaxError: Class cannot be used as object. */ /* @@? 20:12 Error SyntaxError: Unexpected token '{'. */ /* @@? 22:11 Error SyntaxError: Unexpected token 'Nu'. */ /* @@? 23:1 Error SyntaxError: Unexpected token, expected an identifier. */ @@ -48,7 +48,7 @@ int = 10 /* @@? 24:21 Error SyntaxError: Label must be followed by a loop statement. */ /* @@? 24:21 Error TypeError: Unresolved reference s */ /* @@? 24:23 Error SyntaxError: Unexpected token 'A'. */ -/* @@? 24:23 Error TypeError: Class name 'A' used in the wrong context */ +/* @@? 24:23 Error SyntaxError: Class cannot be used as object. */ /* @@? 24:25 Error SyntaxError: Unexpected token '{'. */ /* @@? 25:1 Error SyntaxError: Unexpected token 'int'. */ /* @@? 26:1 Error SyntaxError: Unexpected token ')'. */ diff --git a/ets2panda/test/ast/parser/ets/user_defined_5.ets b/ets2panda/test/ast/parser/ets/user_defined_5.ets index bdf44a3c52233139d5dfcb3a16e90824bcb0b80b..54076098618908af969d791ce536c4b67d49c011 100644 --- a/ets2panda/test/ast/parser/ets/user_defined_5.ets +++ b/ets2panda/test/ast/parser/ets/user_defined_5.ets @@ -19,3 +19,4 @@ enum /* @@ label */double { /* @@@ label Error SyntaxError: Cannot be used as user-defined type. */ /* @@@ label Error SyntaxError: Identifier expected, got 'double'. */ +/* @@@ label Error SyntaxError: Hard keyword 'double' cannot be used as identifier */ diff --git a/ets2panda/test/ast/parser/ets/user_defined_7.ets b/ets2panda/test/ast/parser/ets/user_defined_7.ets index 67c6eec0952f3d56ce21ecaac8914f1f39d2f4bc..587457df03a00716aa658dc94de604c15c31a1a7 100644 --- a/ets2panda/test/ast/parser/ets/user_defined_7.ets +++ b/ets2panda/test/ast/parser/ets/user_defined_7.ets @@ -19,6 +19,7 @@ interface /* @@ label1 */double { /* @@@ label1 Error SyntaxError: Cannot be used as user-defined type. */ /* @@@ label1 Error SyntaxError: Identifier expected, got 'double'. */ +/* @@@ label1 Error SyntaxError: Hard keyword 'double' cannot be used as identifier */ /* @@@ label2 Error SyntaxError: Interface member initialization is prohibited. */ /* @@@ label3 Error SyntaxError: Unexpected token, expected ','. */ /* @@? 17:51 Error SyntaxError: Unexpected token, expected 'private' or identifier. */ diff --git a/ets2panda/test/ast/parser/ets/wrong_context_class_1.ets b/ets2panda/test/ast/parser/ets/wrong_context_class_1.ets index ecd46879d0e0c80712a7af51636e30c79b3fa44d..76848aae0f9f83e4668fcc2fda5156914f68e2d2 100644 --- a/ets2panda/test/ast/parser/ets/wrong_context_class_1.ets +++ b/ets2panda/test/ast/parser/ets/wrong_context_class_1.ets @@ -22,5 +22,5 @@ function main() /* @@ label */a = /* @@ label1 */5 } -/* @@@ label Error TypeError: Class name 'a' used in the wrong context */ +/* @@@ label Error SyntaxError: Class cannot be used as object. */ /* @@@ label1 Error TypeError: Type 'Int' cannot be assigned to type 'a' */ diff --git a/ets2panda/test/ast/parser/ets/wrong_context_class_2.ets b/ets2panda/test/ast/parser/ets/wrong_context_class_2.ets index c0f2c427e82dccb6483392f2109d4bd7cfb81132..f26cb6dee62a19595f38e4a39a61b61ad9fc41ee 100644 --- a/ets2panda/test/ast/parser/ets/wrong_context_class_2.ets +++ b/ets2panda/test/ast/parser/ets/wrong_context_class_2.ets @@ -23,5 +23,5 @@ function main() b = a } -/* @@? 23:9 Error TypeError: Class name 'a' used in the wrong context */ +/* @@? 23:9 Error SyntaxError: Class cannot be used as object. */ /* @@? 23:9 Error TypeError: Type 'a' cannot be assigned to type 'Int' */ diff --git a/ets2panda/test/ast/parser/ets/wrong_context_class_3.ets b/ets2panda/test/ast/parser/ets/wrong_context_class_3.ets index d0818058f7509ad8b2de829024f7ae2cccc7cad0..6b54667d9f58ff7fa9839619ce1637c9924a6597 100644 --- a/ets2panda/test/ast/parser/ets/wrong_context_class_3.ets +++ b/ets2panda/test/ast/parser/ets/wrong_context_class_3.ets @@ -22,5 +22,5 @@ function main() a++ } -/* @@? 22:5 Error TypeError: Class name 'a' used in the wrong context */ +/* @@? 22:5 Error SyntaxError: Class cannot be used as object. */ /* @@? 22:5 Error TypeError: Bad operand type, the type of the operand must be numeric type. */ diff --git a/ets2panda/test/ast/parser/ets/wrong_context_class_4.ets b/ets2panda/test/ast/parser/ets/wrong_context_class_4.ets index 3af604d858f5423baff2ed5b652ef0c2496a4b0f..531f3707e9d4884f12e13970a64c909b609d5960 100644 --- a/ets2panda/test/ast/parser/ets/wrong_context_class_4.ets +++ b/ets2panda/test/ast/parser/ets/wrong_context_class_4.ets @@ -27,4 +27,4 @@ function main() } /* @@? 26:5 Error TypeError: Indexed signatures are not allowed. Use arrays instead! */ -/* @@? 26:5 Error TypeError: Class name 'a' used in the wrong context */ +/* @@? 26:5 Error SyntaxError: Class cannot be used as object. */ diff --git a/ets2panda/test/ast/parser/js/this-expression.js b/ets2panda/test/ast/parser/js/this-expression.js index c0245f85315fa3eaad75d2a01c0434bf306f0ce9..884e65196010ee62a126622aa5a4316a560c97f8 100644 --- a/ets2panda/test/ast/parser/js/this-expression.js +++ b/ets2panda/test/ast/parser/js/this-expression.js @@ -17,3 +17,4 @@ this./* @@ label */"foo"; /* @@@ label Error SyntaxError: Identifier expected, got 'string literal'. */ +/* @@@ label Error SyntaxError: Number, string or computed value property name 'foo' is not allowed, use classes to access data by property names that are identifiers */ diff --git a/ets2panda/test/ast/parser/ts/test-interface2.ts b/ets2panda/test/ast/parser/ts/test-interface2.ts index 95377c99273b38af756a61dbb8f5904b22bb978e..9e3c4b26f6c39782c30d55d4bed86f79ddad8026 100644 --- a/ets2panda/test/ast/parser/ts/test-interface2.ts +++ b/ets2panda/test/ast/parser/ts/test-interface2.ts @@ -16,3 +16,4 @@ interface /* @@ label */5 { } /* @@@ label Error SyntaxError: Identifier expected, got 'number literal'. */ +/* @@@ label Error SyntaxError: Number, string or computed value property name '5' is not allowed, use classes to access data by property names that are identifiers */ diff --git a/ets2panda/test/compiler/ets/abstractNewClassInstanceExpression-expected.txt b/ets2panda/test/compiler/ets/abstractNewClassInstanceExpression-expected.txt index 7d401ea3ae94487adc738e9d9b80f5ca88cadc5a..c9fa2adc08312d33da3ddeba3ff9f15566567d19 100644 --- a/ets2panda/test/compiler/ets/abstractNewClassInstanceExpression-expected.txt +++ b/ets2panda/test/compiler/ets/abstractNewClassInstanceExpression-expected.txt @@ -1297,6 +1297,6 @@ TypeError: A is abstract therefore cannot be instantiated. [abstractNewClassInst SyntaxError: Unexpected token '{'. [abstractNewClassInstanceExpression.ets:26:22] TypeError: Method foo(): void in B not overriding any method [abstractNewClassInstanceExpression.ets:27:21] SyntaxError: Label must be followed by a loop statement. [abstractNewClassInstanceExpression.ets:32:11] -TypeError: Class name 'H' used in the wrong context [abstractNewClassInstanceExpression.ets:32:11] +SyntaxError: Class cannot be used as object. [abstractNewClassInstanceExpression.ets:32:11] SyntaxError: Unexpected token '{'. [abstractNewClassInstanceExpression.ets:32:23] SyntaxError: Unexpected token '}'. [abstractNewClassInstanceExpression.ets:35:1] diff --git a/ets2panda/util/diagnostic/syntax.yaml b/ets2panda/util/diagnostic/syntax.yaml index 8a1a9bafa9cc0a3418103f5191e12558fdcde633..fef5d62ff27ad612df4680c0c147b50164cb8958 100644 --- a/ets2panda/util/diagnostic/syntax.yaml +++ b/ets2panda/util/diagnostic/syntax.yaml @@ -1267,3 +1267,23 @@ syntax: - name: GENERATOR_FUNCTION id: 314 message: "Generator functions are not supported, please use async/await mechanism for multitasking" + +- name: LITERAL_VALUE_IDENT + id: 315 + message: "Number, string or computed value property name '{}' is not allowed, use classes to access data by property names that are identifiers" + +- name: HARD_KEYWORD_IDENT + id: 316 + message: "Hard keyword '{}' cannot be used as identifier" + +- name: NOT_AS_OBJECT + id: 318 + message: "{} cannot be used as object." + +- name: FIELD_IN_PARAM + id: 319 + message: "Declaring fields in parameter list is not supported" + +- name: FUNC_EXPR + id: 320 + message: "Function expressions are not supported, use arrow functions instead"