From 451ad8ae99ba8aa8669fecdd27170f3856d7d8bc Mon Sep 17 00:00:00 2001 From: Boglarka Date: Thu, 5 Jun 2025 15:03:49 +0200 Subject: [PATCH] Add error for using namespases as object Issue: https://gitee.com/openharmony/arkcompiler_ets_frontend/issues/ICCJ7D Reason: Using namespaces or classes as object is invalid Description: Modified error masseges Signed-off-by: Haag Boglarka --- ets2panda/checker/ets/helpers.cpp | 6 ++++-- .../test/ast/compiler/ets/FixedArray/tuple_types_9_neg.ets | 2 +- .../compiler/ets/namespace_tests/namespace_as_type11.ets | 2 +- ets2panda/test/ast/compiler/ets/static_index_function1.ets | 2 +- ets2panda/test/ast/compiler/ets/static_index_function2.ets | 2 +- .../ets/type_error_processing/not_constructible_types.ets | 2 +- .../annotations_tests/annotationDecl_bad_initializer01.ets | 2 +- .../ets/annotations_tests/annotationUsage_bad_param01.ets | 2 +- .../annotationUsage_bad_param_for_classproperty.ets | 4 ++-- .../annotationUsage_bad_param_for_function_param.ets | 2 +- .../annotationUsage_bad_param_for_global_variable_decl.ets | 2 +- .../annotationUsage_bad_param_for_interface.ets | 2 +- .../annotationUsage_bad_param_for_interfacemethod.ets | 2 +- .../annotationUsage_bad_param_for_interfaceproperty.ets | 2 +- .../annotationUsage_bad_param_for_local_variable_decl.ets | 2 +- .../annotationUsage_bad_param_for_type_alias.ets | 4 ++-- ets2panda/test/ast/parser/ets/async_function_bad.ets | 2 +- ets2panda/test/ast/parser/ets/type_references.ets | 2 +- ets2panda/test/ast/parser/ets/unexpected_token_62.ets | 4 ++-- ets2panda/test/ast/parser/ets/wrong_context_class_1.ets | 2 +- ets2panda/test/ast/parser/ets/wrong_context_class_2.ets | 2 +- ets2panda/test/ast/parser/ets/wrong_context_class_3.ets | 2 +- ets2panda/test/ast/parser/ets/wrong_context_class_4.ets | 2 +- .../ets/abstractNewClassInstanceExpression-expected.txt | 2 +- ets2panda/util/diagnostic/syntax.yaml | 4 ++++ 25 files changed, 34 insertions(+), 28 deletions(-) diff --git a/ets2panda/checker/ets/helpers.cpp b/ets2panda/checker/ets/helpers.cpp index 553abd66e2..10a0cfd60a 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/test/ast/compiler/ets/FixedArray/tuple_types_9_neg.ets b/ets2panda/test/ast/compiler/ets/FixedArray/tuple_types_9_neg.ets index 978f7ce86d..baddef4e13 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/namespace_tests/namespace_as_type11.ets b/ets2panda/test/ast/compiler/ets/namespace_tests/namespace_as_type11.ets index b9f5b38405..eb120df6c8 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 a341c997c9..36c1a7ebd5 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 9659ccec52..c6ae1e214f 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 05eb89b3eb..4341a3928c 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/annotations_tests/annotationDecl_bad_initializer01.ets b/ets2panda/test/ast/parser/ets/annotations_tests/annotationDecl_bad_initializer01.ets index c91e54e8e1..1c44ded693 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/annotationUsage_bad_param01.ets b/ets2panda/test/ast/parser/ets/annotations_tests/annotationUsage_bad_param01.ets index 291e9fc476..2fb3feaa78 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 6bda66d089..389af848c7 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 4b9930aa0d..cf347df6c7 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 42cc5b89bb..535b365f32 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 b05a133e46..d544f882f7 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 1dc2531c2f..ae609bf8f8 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 87ea5db605..4ce655dabf 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 bcb548094f..9c65ff8922 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 20828eff75..9eb2aa1f06 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 6b628497f9..b55c2ffaf8 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/type_references.ets b/ets2panda/test/ast/parser/ets/type_references.ets index b689bb2c97..a5db99d97c 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 b397c9a783..78b6905b98 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/wrong_context_class_1.ets b/ets2panda/test/ast/parser/ets/wrong_context_class_1.ets index ecd46879d0..76848aae0f 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 c0f2c427e8..f26cb6dee6 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 d0818058f7..6b54667d9f 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 3af604d858..531f3707e9 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/compiler/ets/abstractNewClassInstanceExpression-expected.txt b/ets2panda/test/compiler/ets/abstractNewClassInstanceExpression-expected.txt index 7d401ea3ae..c9fa2adc08 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 8a1a9bafa9..738cf548cd 100644 --- a/ets2panda/util/diagnostic/syntax.yaml +++ b/ets2panda/util/diagnostic/syntax.yaml @@ -1267,3 +1267,7 @@ syntax: - name: GENERATOR_FUNCTION id: 314 message: "Generator functions are not supported, please use async/await mechanism for multitasking" + +- name: NOT_AS_OBJECT + id: 315 + message: "{} cannot be used as object." \ No newline at end of file -- Gitee