From 0986b098b1426a7ce507e232e79ce417c0203f20 Mon Sep 17 00:00:00 2001 From: yaozhupeng Date: Wed, 9 Apr 2025 14:42:06 +0800 Subject: [PATCH] change error message Signed-off-by: yaozhupeng --- .../extension_function_miss_signature.ets | 7 ++++--- .../scopes_multi_error.ets | 2 ++ .../compiler/ets/recordWithLambdaFunction2.ets | 4 +++- .../type_error_processing/var_without_def.ets | 2 +- .../FixedArray/FunctionalTypeAsArrayElement.ets | 2 +- .../ets/FixedArray/MultipleParserErrors.ets | 16 ++++++---------- .../ets/FixedArray/n_arrayHoldingNullValue.ets | 4 ++-- .../Readonly-with-ArrayType-test1.ets | 4 ++-- .../Readonly-with-ArrayType-test4.ets | 2 +- .../parser/ets/FixedArray/spreadArrayInTuple.ets | 4 ++-- .../parser/ets/FixedArray/trailing_comma_1.ets | 1 + .../parser/ets/FixedArray/tuple_type_2_neg.ets | 1 + .../ets/FixedArray/type_argument_conversion.ets | 4 ++-- .../ets/FixedArray/unexpected_token_42.ets | 2 +- .../ets/FixedArray/unexpected_token_47.ets | 2 +- .../FixedArray/wrong-union-array-assignment.ets | 2 +- .../parser/ets/FunctionalTypeAsArrayElement.ets | 2 +- .../test/ast/parser/ets/MultipleParserErrors.ets | 6 +++--- .../ets/generic_defined_before_use_neg_5.ets | 2 +- .../test/ast/parser/ets/keyof_array_tuple.ets | 12 ++++++------ .../test/ast/parser/ets/main_entry_point_5.ets | 3 ++- .../ast/parser/ets/n_arrayHoldingNullValue.ets | 4 ++-- .../Readonly-with-ArrayType-test1.ets | 4 ++-- .../Readonly-with-ArrayType-test4.ets | 2 +- .../readonly-parameter-test3.ets | 2 +- .../readonly-parameter-test4.ets | 4 ++-- ets2panda/test/ast/parser/ets/recordIndexing.ets | 4 +++- .../test/ast/parser/ets/spreadArrayInTuple.ets | 8 ++++---- .../test/ast/parser/ets/trailing_comma_1.ets | 1 + .../test/ast/parser/ets/tuple_trailing_comma.ets | 1 + .../test/ast/parser/ets/tuple_type_2_neg.ets | 1 + .../test/ast/parser/ets/tuple_type_3_neg.ets | 3 +-- .../test/ast/parser/ets/tuple_type_4_neg.ets | 1 + .../ast/parser/ets/type_argument_conversion.ets | 16 ++++++++-------- .../test/ast/parser/ets/unexpected_token_42.ets | 2 +- .../test/ast/parser/ets/unexpected_token_47.ets | 2 +- .../parser/ets/wrong-union-array-assignment.ets | 2 +- 37 files changed, 75 insertions(+), 66 deletions(-) diff --git a/ets2panda/test/ast/compiler/ets/extension_function_tests/extension_function_miss_signature.ets b/ets2panda/test/ast/compiler/ets/extension_function_tests/extension_function_miss_signature.ets index 8f4bc7463..9a5fdae9f 100644 --- a/ets2panda/test/ast/compiler/ets/extension_function_tests/extension_function_miss_signature.ets +++ b/ets2panda/test/ast/compiler/ets/extension_function_tests/extension_function_miss_signature.ets @@ -39,6 +39,7 @@ function main() { asMethodCall(); } -/* @@? 30:5 Error TypeError: Expected 2 arguments, got 3. */ -/* @@? 30:5 Error TypeError: No matching call signature for foo(Fruit, double, double) */ -/* @@? 34:5 Error TypeError: No matching call signature for foo(double, double) */ +/* @@? 30:5 Error TypeError: Expected 2 arguments, got 3. */ +/* @@? 30:5 Error TypeError: No matching call signature for foo(Fruit, double, double) */ +/* @@? 34:5 Error TypeError: No matching call signature for foo(Fruit, double, double) */ +/* @@? 34:5 Error TypeError: No matching call signature for foo(double, double) */ diff --git a/ets2panda/test/ast/compiler/ets/implicit_package_import/scopes_multi_error.ets b/ets2panda/test/ast/compiler/ets/implicit_package_import/scopes_multi_error.ets index 56a2fd057..40eb81eb8 100644 --- a/ets2panda/test/ast/compiler/ets/implicit_package_import/scopes_multi_error.ets +++ b/ets2panda/test/ast/compiler/ets/implicit_package_import/scopes_multi_error.ets @@ -29,6 +29,8 @@ export default function TestFunc(): void {} export default function TestFuncToo(): void {} /* @@? 20:10 Error TypeError: Main overload is not enabled */ +/* @@? 20:15 Error TypeError: Only 'string[]' type argument is allowed. */ /* @@? 24:10 Error TypeError: Main overload is not enabled */ /* @@? 24:10 Error TypeError: 0 or 1 argument are allowed */ /* @@? 29:16 Error TypeError: Only one default export is allowed in a module */ +/* @@? 29:16 Error TypeError: Only one default export is allowed in a module */ diff --git a/ets2panda/test/ast/compiler/ets/recordWithLambdaFunction2.ets b/ets2panda/test/ast/compiler/ets/recordWithLambdaFunction2.ets index 10e6cc1ed..ee59e2834 100644 --- a/ets2panda/test/ast/compiler/ets/recordWithLambdaFunction2.ets +++ b/ets2panda/test/ast/compiler/ets/recordWithLambdaFunction2.ets @@ -23,4 +23,6 @@ function main(): void { handlerMap[/* @@ label */2] = 1 } -/* @@@ label Error TypeError: Cannot find index access method with the required signature. */ +/* @@? 23:5 Error TypeError: No matching indexing signature for $_set(int, int) */ +/* @@? 23:30 Error TypeError: Cannot find index access method with the required signature. */ +/* @@? 23:35 Error TypeError: Type 'int' is not compatible with type '(param: Double) => String' at index 2 * diff --git a/ets2panda/test/ast/compiler/ets/type_error_processing/var_without_def.ets b/ets2panda/test/ast/compiler/ets/type_error_processing/var_without_def.ets index e183093f4..d7e242424 100644 --- a/ets2panda/test/ast/compiler/ets/type_error_processing/var_without_def.ets +++ b/ets2panda/test/ast/compiler/ets/type_error_processing/var_without_def.ets @@ -27,4 +27,4 @@ function foo() { /* @@? 16:1 Error TypeError: Unresolved reference a */ /* @@? 20:1 Error TypeError: Unresolved reference c */ /* @@? 24:5 Error TypeError: Unresolved reference void */ -/* @@? 24:18 Error TypeError: Unresolved reference asyncGenerator */ +/* @@? 24:12 Error TypeError: Expected type for array literal should be an array type, got *ERROR_TYPE* */ diff --git a/ets2panda/test/ast/parser/ets/FixedArray/FunctionalTypeAsArrayElement.ets b/ets2panda/test/ast/parser/ets/FixedArray/FunctionalTypeAsArrayElement.ets index 43ec5bf31..e6559e42e 100644 --- a/ets2panda/test/ast/parser/ets/FixedArray/FunctionalTypeAsArrayElement.ets +++ b/ets2panda/test/ast/parser/ets/FixedArray/FunctionalTypeAsArrayElement.ets @@ -19,4 +19,4 @@ function main(){ ] } -/* @@? 17:48 Error TypeError: Expected type for array literal should be an array type, got () => int[] */ +/* @@? 17:48 Error TypeError: Expected type for array literal should be an array type, got () => FixedArray */ diff --git a/ets2panda/test/ast/parser/ets/FixedArray/MultipleParserErrors.ets b/ets2panda/test/ast/parser/ets/FixedArray/MultipleParserErrors.ets index f5772aef2..e489878f2 100644 --- a/ets2panda/test/ast/parser/ets/FixedArray/MultipleParserErrors.ets +++ b/ets2panda/test/ast/parser/ets/FixedArray/MultipleParserErrors.ets @@ -170,9 +170,9 @@ function main(): void { /* @@? 28:29 Error TypeError: Native, Abstract and Declare methods cannot have body. */ /* @@? 34:14 Error SyntaxError: The modifier for a constructor should be limited to access modifiers (private, internal, protected, public), and 'native' modifiers. */ /* @@? 37:41 Error SyntaxError: Only 'throws' can be used with function types. */ -/* @@? 39:14 Error SyntaxError: Unexpected token, expected an identifier. */ /* @@? 39:14 Error SyntaxError: Parameter declaration should have an explicit type annotation. */ /* @@? 39:14 Error SyntaxError: Unexpected token, expected ',' or ')'. */ +/* @@? 39:14 Error SyntaxError: Unexpected token, expected an identifier. */ /* @@? 39:24 Error SyntaxError: Unexpected token 'int'. */ /* @@? 39:24 Error TypeError: Unresolved reference int */ /* @@? 39:27 Error SyntaxError: Unexpected token ')'. */ @@ -195,18 +195,16 @@ function main(): void { /* @@? 51:43 Error SyntaxError: Label must be followed by a loop statement. */ /* @@? 51:43 Error TypeError: Unresolved reference FixedArray */ /* @@? 51:58 Error SyntaxError: Unexpected token, expected '('. */ -/* @@? 51:59 Error SyntaxError: Unexpected token, expected ',' or ')'. */ /* @@? 51:59 Error SyntaxError: Unexpected token ':'. */ +/* @@? 51:59 Error SyntaxError: Unexpected token, expected ',' or ')'. */ /* @@? 51:59 Error SyntaxError: Unexpected token ':'. */ /* @@? 51:59 Error SyntaxError: Unexpected token ':'. */ /* @@? 51:59 Error SyntaxError: Unexpected token ':'. */ /* @@? 51:65 Error SyntaxError: Unexpected token '{'. */ /* @@? 52:5 Error SyntaxError: return keyword should be used in function body. */ -/* @@? 52:12 Error TypeError: Unresolved reference q */ /* @@? 52:12 Error TypeError: All return statements in the function should be empty or have a value. */ +/* @@? 52:12 Error TypeError: Unresolved reference q */ /* @@? 52:23 Error TypeError: Unresolved reference p */ -/* @@? 55:26 Error SyntaxError: Rest parameter should be of an array type. */ -/* @@? 59:23 Error SyntaxError: Rest parameter should be of an array type. */ /* @@? 63:26 Error SyntaxError: Parameter declaration should have an explicit type annotation. */ /* @@? 67:7 Error TypeError: Variable 'A' has already been declared. */ /* @@? 68:3 Error SyntaxError: Unexpected token. A constructor, method, accessor, or property was expected. */ @@ -219,8 +217,6 @@ function main(): void { /* @@? 84:3 Error SyntaxError: Unexpected token. A constructor, method, accessor, or property was expected. */ /* @@? 92:7 Error TypeError: Variable 'A' has already been declared. */ /* @@? 93:3 Error SyntaxError: Unexpected token. A constructor, method, accessor, or property was expected. */ -/* @@? 103:25 Error SyntaxError: Rest parameter should be of an array type. */ -/* @@? 104:32 Error SyntaxError: Rest parameter should be of an array type. */ /* @@? 115:26 Error SyntaxError: Unexpected token 'case'. */ /* @@? 115:26 Error SyntaxError: Unexpected token 'case'. */ /* @@? 115:26 Error SyntaxError: Unexpected token, expected ',' or ')'. */ @@ -255,16 +251,16 @@ function main(): void { /* @@? 120:12 Error TypeError: All return statements in the function should be empty or have a value. */ /* @@? 123:5 Error SyntaxError: Identifier expected, got ','. */ /* @@? 123:6 Error SyntaxError: Variable must be initialized or it's type must be declared. */ -/* @@? 123:6 Error SyntaxError: Variable must be initialized or it's type must be declared. */ /* @@? 123:6 Error SyntaxError: Unexpected token 'abc'. */ +/* @@? 123:6 Error SyntaxError: Variable must be initialized or it's type must be declared. */ /* @@? 123:6 Error TypeError: Unresolved reference abc */ /* @@? 127:1 Error SyntaxError: The modifier async cannot be used in an ambient context. */ /* @@? 132:14 Error SyntaxError: Unexpected token, expected an identifier. */ -/* @@? 137:16 Error SyntaxError: Catch clause variable cannot have an initializer. */ /* @@? 137:16 Error SyntaxError: Expected ')', got '='. */ +/* @@? 137:16 Error SyntaxError: Catch clause variable cannot have an initializer. */ /* @@? 137:16 Error SyntaxError: Expected '{', got '='. */ -/* @@? 137:16 Error SyntaxError: Unexpected token '='. */ /* @@? 137:16 Error SyntaxError: Expected '{', got '='. */ +/* @@? 137:16 Error SyntaxError: Unexpected token '='. */ /* @@? 137:19 Error SyntaxError: Unexpected token ')'. */ /* @@? 137:19 Error SyntaxError: Unexpected token ')'. */ /* @@? 137:19 Error SyntaxError: Unexpected token ')'. */ diff --git a/ets2panda/test/ast/parser/ets/FixedArray/n_arrayHoldingNullValue.ets b/ets2panda/test/ast/parser/ets/FixedArray/n_arrayHoldingNullValue.ets index 0c383d07e..89238cd2b 100644 --- a/ets2panda/test/ast/parser/ets/FixedArray/n_arrayHoldingNullValue.ets +++ b/ets2panda/test/ast/parser/ets/FixedArray/n_arrayHoldingNullValue.ets @@ -18,5 +18,5 @@ function main(): void { let d: FixedArray = /* @@ label1 */null; } -/* @@? 17:48 Error TypeError: Type 'null' cannot be assigned to type 'float[]' */ -/* @@? 18:46 Error TypeError: Type 'null' cannot be assigned to type 'char[]' */ +/* @@? 17:48 Error TypeError: Type 'null' cannot be assigned to type 'FixedArray' */ +/* @@? 18:46 Error TypeError: Type 'null' cannot be assigned to type 'FixedArray' */ diff --git a/ets2panda/test/ast/parser/ets/FixedArray/readonly-parameter-test/Readonly-with-ArrayType-test1.ets b/ets2panda/test/ast/parser/ets/FixedArray/readonly-parameter-test/Readonly-with-ArrayType-test1.ets index e6e3685fd..2ca4a147d 100644 --- a/ets2panda/test/ast/parser/ets/FixedArray/readonly-parameter-test/Readonly-with-ArrayType-test1.ets +++ b/ets2panda/test/ast/parser/ets/FixedArray/readonly-parameter-test/Readonly-with-ArrayType-test1.ets @@ -19,5 +19,5 @@ function foo (p: FixedArray) { let x: Readonly> = [] /* @@ label */foo(/* @@ label1 */x) -/* @@? 20:15 Error TypeError: No matching call signature for foo(readonly int[]) */ -/* @@? 20:34 Error TypeError: Type 'readonly int[]' is not compatible with type 'int[]' at index 1 */ +/* @@? 20:15 Error TypeError: No matching call signature for foo(readonly FixedArray) */ +/* @@? 20:34 Error TypeError: Type 'readonly FixedArray' is not compatible with type 'FixedArray' at index 1 */ diff --git a/ets2panda/test/ast/parser/ets/FixedArray/readonly-parameter-test/Readonly-with-ArrayType-test4.ets b/ets2panda/test/ast/parser/ets/FixedArray/readonly-parameter-test/Readonly-with-ArrayType-test4.ets index 1ab798fd9..4b0401da4 100644 --- a/ets2panda/test/ast/parser/ets/FixedArray/readonly-parameter-test/Readonly-with-ArrayType-test4.ets +++ b/ets2panda/test/ast/parser/ets/FixedArray/readonly-parameter-test/Readonly-with-ArrayType-test4.ets @@ -18,4 +18,4 @@ function foo (x: Readonly>) { let x1 : FixedArray x1 = /* @@ label */x } -/* @@? 19:24 Error TypeError: Type 'readonly int[]' cannot be assigned to type 'int[]' */ +/* @@? 19:24 Error TypeError: Type 'readonly FixedArray' cannot be assigned to type 'FixedArray' */ diff --git a/ets2panda/test/ast/parser/ets/FixedArray/spreadArrayInTuple.ets b/ets2panda/test/ast/parser/ets/FixedArray/spreadArrayInTuple.ets index 2b0ded621..b663614e7 100644 --- a/ets2panda/test/ast/parser/ets/FixedArray/spreadArrayInTuple.ets +++ b/ets2panda/test/ast/parser/ets/FixedArray/spreadArrayInTuple.ets @@ -21,6 +21,6 @@ function main() { } /* @@? 18:43 Error TypeError: Initializer has 1 elements, but tuple requires 2 */ -/* @@? 18:59 Error TypeError: '(Int|String)[]' cannot be spread in tuple. */ +/* @@? 18:59 Error TypeError: 'Array' cannot be spread in tuple. */ /* @@? 20:53 Error TypeError: Initializer has 2 elements, but tuple requires 3 */ -/* @@? 20:75 Error TypeError: '(Int|String)[]' cannot be spread in tuple. */ +/* @@? 20:75 Error TypeError: 'Array' cannot be spread in tuple. */ diff --git a/ets2panda/test/ast/parser/ets/FixedArray/trailing_comma_1.ets b/ets2panda/test/ast/parser/ets/FixedArray/trailing_comma_1.ets index 2c036d74f..1bde22bbc 100644 --- a/ets2panda/test/ast/parser/ets/FixedArray/trailing_comma_1.ets +++ b/ets2panda/test/ast/parser/ets/FixedArray/trailing_comma_1.ets @@ -38,6 +38,7 @@ foo(,) /* @@? 16:40 Error SyntaxError: Rest parameter must be the last formal parameter. */ /* @@? 24:15 Error SyntaxError: Unexpected token, expected an identifier. */ /* @@? 24:15 Error SyntaxError: Parameter declaration should have an explicit type annotation. */ +/* @@? 28:9 Error TypeError: Expected type for array literal should be an array type, got *ERROR_TYPE* */ /* @@? 28:12 Error SyntaxError: Unexpected token ','. */ /* @@? 30:5 Error TypeError: Indexed access is not supported for such expression type. */ /* @@? 31:1 Error TypeError: No matching call signature for foo(a[0], a[1], ...a) */ diff --git a/ets2panda/test/ast/parser/ets/FixedArray/tuple_type_2_neg.ets b/ets2panda/test/ast/parser/ets/FixedArray/tuple_type_2_neg.ets index cb10ec2a9..2caf285a0 100644 --- a/ets2panda/test/ast/parser/ets/FixedArray/tuple_type_2_neg.ets +++ b/ets2panda/test/ast/parser/ets/FixedArray/tuple_type_2_neg.ets @@ -34,3 +34,4 @@ let a: [number, FixedArray<...number>, number] = [1, 2, 3]; /* @@? 17:46 Error SyntaxError: Unexpected token ']'. */ /* @@? 17:46 Error SyntaxError: Unexpected token ']'. */ /* @@? 17:48 Error SyntaxError: Unexpected token '='. */ +/* @@? 17:50 Error TypeError: Expected type for array literal should be an array type, got *ERROR_TYPE* */ diff --git a/ets2panda/test/ast/parser/ets/FixedArray/type_argument_conversion.ets b/ets2panda/test/ast/parser/ets/FixedArray/type_argument_conversion.ets index 19e6582cc..a2a202830 100644 --- a/ets2panda/test/ast/parser/ets/FixedArray/type_argument_conversion.ets +++ b/ets2panda/test/ast/parser/ets/FixedArray/type_argument_conversion.ets @@ -30,11 +30,11 @@ function main(): int { return 0; } -/* @@? 29:34 Error TypeError: No matching construct signature for type_argument_conversion.A(A[]) */ +/* @@? 29:34 Error TypeError: No matching construct signature for type_argument_conversion.A(Array>) */ /* @@? 29:58 Error TypeError: No Matching Parameterless Constructor, parameter count 1 */ /* @@? 29:58 Error TypeError: No matching parameterless constructor */ /* @@? 29:58 Error TypeError: Signature is not available here. */ -/* @@? 29:58 Error TypeError: Type 'A[]' is not compatible with type 'A[]' at index 1 */ +/* @@? 29:58 Error TypeError: Type 'Array>' is not compatible with type 'FixedArray>' at index 1 */ /* @@? 29:58 Error TypeError: No Matching Parameterless Constructor, parameter count 1 */ /* @@? 29:58 Error TypeError: No matching parameterless constructor */ /* @@? 29:58 Error TypeError: Signature is not available here. */ diff --git a/ets2panda/test/ast/parser/ets/FixedArray/unexpected_token_42.ets b/ets2panda/test/ast/parser/ets/FixedArray/unexpected_token_42.ets index 0eebb0e52..6c15652a0 100644 --- a/ets2panda/test/ast/parser/ets/FixedArray/unexpected_token_42.ets +++ b/ets2panda/test/ast/parser/ets/FixedArray/unexpected_token_42.ets @@ -15,5 +15,5 @@ // Int[1,2,3,4,5] let a: number = new Int[1 -/* @@? 16:17 Error TypeError: Type 'Int[]' cannot be assigned to type 'double' */ +/* @@? 16:17 Error TypeError: Type 'FixedArray' cannot be assigned to type 'double' */ /* @@? 20:1 Error SyntaxError: Expected ']', got 'eos'. */ diff --git a/ets2panda/test/ast/parser/ets/FixedArray/unexpected_token_47.ets b/ets2panda/test/ast/parser/ets/FixedArray/unexpected_token_47.ets index b2c56eccb..9f4742ad8 100644 --- a/ets2panda/test/ast/parser/ets/FixedArray/unexpected_token_47.ets +++ b/ets2panda/test/ast/parser/ets/FixedArray/unexpected_token_47.ets @@ -15,7 +15,7 @@ let isPrime: FixedArray = new int[[]][[] -/* @@? 16:32 Error TypeError: Type 'int[][]' cannot be assigned to type 'int[]' */ +/* @@? 16:32 Error TypeError: Type 'FixedArray>' cannot be assigned to type 'FixedArray' */ /* @@? 16:40 Error TypeError: Can't resolve array type */ /* @@? 16:44 Error TypeError: Can't resolve array type */ /* @@? 22:1 Error SyntaxError: Expected ']', got 'eos'. */ diff --git a/ets2panda/test/ast/parser/ets/FixedArray/wrong-union-array-assignment.ets b/ets2panda/test/ast/parser/ets/FixedArray/wrong-union-array-assignment.ets index 3f5cb64de..287b7a65a 100644 --- a/ets2panda/test/ast/parser/ets/FixedArray/wrong-union-array-assignment.ets +++ b/ets2panda/test/ast/parser/ets/FixedArray/wrong-union-array-assignment.ets @@ -24,4 +24,4 @@ function main() array = /* @@ label */new Bad(); } -/* @@? 24:27 Error TypeError: Type 'Bad' cannot be assigned to type '(Int|Double|String)[]' */ +/* @@? 24:27 Error TypeError: Type 'Bad' cannot be assigned to type 'Array' */ diff --git a/ets2panda/test/ast/parser/ets/FunctionalTypeAsArrayElement.ets b/ets2panda/test/ast/parser/ets/FunctionalTypeAsArrayElement.ets index e722a6f37..4e6298318 100644 --- a/ets2panda/test/ast/parser/ets/FunctionalTypeAsArrayElement.ets +++ b/ets2panda/test/ast/parser/ets/FunctionalTypeAsArrayElement.ets @@ -19,4 +19,4 @@ function main(){ ] } -/* @@@ label Error TypeError: Expected type for array literal should be an array type, got () => int[] */ +/* @@? 17:38 Error TypeError: Expected type for array literal should be an array type, got () => Array */ diff --git a/ets2panda/test/ast/parser/ets/MultipleParserErrors.ets b/ets2panda/test/ast/parser/ets/MultipleParserErrors.ets index f8d7b3e74..3efdc0db0 100644 --- a/ets2panda/test/ast/parser/ets/MultipleParserErrors.ets +++ b/ets2panda/test/ast/parser/ets/MultipleParserErrors.ets @@ -170,9 +170,9 @@ function main(): void { /* @@? 28:29 Error TypeError: Native, Abstract and Declare methods cannot have body. */ /* @@? 34:14 Error SyntaxError: The modifier for a constructor should be limited to access modifiers (private, internal, protected, public), and 'native' modifiers. */ /* @@? 37:41 Error SyntaxError: Only 'throws' can be used with function types. */ -/* @@? 39:14 Error SyntaxError: Unexpected token, expected an identifier. */ /* @@? 39:14 Error SyntaxError: Parameter declaration should have an explicit type annotation. */ /* @@? 39:14 Error SyntaxError: Unexpected token, expected ',' or ')'. */ +/* @@? 39:14 Error SyntaxError: Unexpected token, expected an identifier. */ /* @@? 39:24 Error SyntaxError: Unexpected token 'int'. */ /* @@? 39:24 Error TypeError: Unresolved reference int */ /* @@? 39:27 Error SyntaxError: Unexpected token ')'. */ @@ -254,10 +254,10 @@ function main(): void { /* @@? 123:6 Error TypeError: Unresolved reference abc */ /* @@? 127:1 Error SyntaxError: The modifier async cannot be used in an ambient context. */ /* @@? 132:14 Error SyntaxError: Unexpected token, expected an identifier. */ +/* @@? 137:16 Error SyntaxError: Expected '{', got '='. */ /* @@? 137:16 Error SyntaxError: Catch clause variable cannot have an initializer. */ /* @@? 137:16 Error SyntaxError: Expected ')', got '='. */ /* @@? 137:16 Error SyntaxError: Expected '{', got '='. */ -/* @@? 137:16 Error SyntaxError: Expected '{', got '='. */ /* @@? 137:16 Error SyntaxError: Unexpected token '='. */ /* @@? 137:19 Error SyntaxError: Unexpected token ')'. */ /* @@? 137:19 Error SyntaxError: Unexpected token ')'. */ @@ -278,4 +278,4 @@ function main(): void { /* @@? 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 */ -/* @@? 286:1 Error SyntaxError: Expected '}', got 'eos'. */ +/* @@? 282:1 Error SyntaxError: Expected '}', got 'eos'. */ diff --git a/ets2panda/test/ast/parser/ets/generic_defined_before_use_neg_5.ets b/ets2panda/test/ast/parser/ets/generic_defined_before_use_neg_5.ets index 3cd51fe7b..807151f8e 100644 --- a/ets2panda/test/ast/parser/ets/generic_defined_before_use_neg_5.ets +++ b/ets2panda/test/ast/parser/ets/generic_defined_before_use_neg_5.ets @@ -14,4 +14,4 @@ */ class SomeType{} function foo(){} -/* @@@ label Error TypeError: Type Parameter T2 should be defined before use. */ +/* @@? 1:3 Error TypeError: Type Parameter T2 should be defined before use. */ diff --git a/ets2panda/test/ast/parser/ets/keyof_array_tuple.ets b/ets2panda/test/ast/parser/ets/keyof_array_tuple.ets index f4ffe47cc..0115739e1 100644 --- a/ets2panda/test/ast/parser/ets/keyof_array_tuple.ets +++ b/ets2panda/test/ast/parser/ets/keyof_array_tuple.ets @@ -33,9 +33,9 @@ function main():void{ let x6:Array<"abcd"|keyofA|number|A> = /* @@ label6 */new Array<"abcd"|keyofA|number|A>("abcd","other field","foo",123,a); } -/* @@@ label1 Error TypeError: Array element at index 1 with type '"field2"' is not compatible with the target array element type '"abcd"|Double|A|"foo"|"field1"' */ -/* @@@ label2 Error TypeError: Array element at index 1 with type '"other field"' is not compatible with the target array element type '"abcd"|Double|A|"foo"|"field1"' */ -/* @@@ label3 Error TypeError: Array initializer's type is not assignable to tuple type at index: 1 */ -/* @@@ label4 Error TypeError: Array initializer's type is not assignable to tuple type at index: 1 */ -/* @@@ label5 Error TypeError: No matching construct signature for escompat.Array("abcd", "field2", "foo", int, A) */ -/* @@@ label6 Error TypeError: No matching construct signature for escompat.Array("abcd", "other field", "foo", int, A) */ +/* @@? 26:62 Error TypeError: Array element type '"field2"' is not assignable to explicit type '"abcd"|Double|A|"foo"|"field1"' */ +/* @@? 27:62 Error TypeError: Array element type '"other field"' is not assignable to explicit type '"abcd"|Double|A|"foo"|"field1"' */ +/* @@? 29:60 Error TypeError: Array initializer's type is not assignable to tuple type at index: 1 */ +/* @@? 30:60 Error TypeError: Array initializer's type is not assignable to tuple type at index: 1 */ +/* @@? 32:57 Error TypeError: No matching construct signature for escompat.Array("abcd", "field2", "foo", int, A) */ +/* @@? 33:57 Error TypeError: No matching construct signature for escompat.Array("abcd", "other field", "foo", int, A) */ diff --git a/ets2panda/test/ast/parser/ets/main_entry_point_5.ets b/ets2panda/test/ast/parser/ets/main_entry_point_5.ets index 3c635da7b..26eb46a2e 100644 --- a/ets2panda/test/ast/parser/ets/main_entry_point_5.ets +++ b/ets2panda/test/ast/parser/ets/main_entry_point_5.ets @@ -21,4 +21,5 @@ function /* @@ label */main(i : string[]): void { return; } -/* @@@ label Error TypeError: Main overload is not enabled */ +/* @@? 20:24 Error TypeError: Main overload is not enabled */ +/* @@? 20:29 Error TypeError: Only 'string[]' type argument is allowed. */ diff --git a/ets2panda/test/ast/parser/ets/n_arrayHoldingNullValue.ets b/ets2panda/test/ast/parser/ets/n_arrayHoldingNullValue.ets index 35a9c180d..33ed150ff 100644 --- a/ets2panda/test/ast/parser/ets/n_arrayHoldingNullValue.ets +++ b/ets2panda/test/ast/parser/ets/n_arrayHoldingNullValue.ets @@ -18,5 +18,5 @@ function main(): void { let d: char[] = /* @@ label1 */null; } -/* @@@ label Error TypeError: Type 'null' cannot be assigned to type 'float[]' */ -/* @@@ label1 Error TypeError: Type 'null' cannot be assigned to type 'char[]' */ +/* @@? 17:38 Error TypeError: Type 'null' cannot be assigned to type 'Array' */ +/* @@? 18:36 Error TypeError: Type 'null' cannot be assigned to type 'Array' */ diff --git a/ets2panda/test/ast/parser/ets/readonly-parameter-test/Readonly-with-ArrayType-test1.ets b/ets2panda/test/ast/parser/ets/readonly-parameter-test/Readonly-with-ArrayType-test1.ets index f58ae21fd..390023611 100644 --- a/ets2panda/test/ast/parser/ets/readonly-parameter-test/Readonly-with-ArrayType-test1.ets +++ b/ets2panda/test/ast/parser/ets/readonly-parameter-test/Readonly-with-ArrayType-test1.ets @@ -19,5 +19,5 @@ function foo (p: int[]) { let x: Readonly = [] /* @@ label */foo(/* @@ label1 */x) -/* @@@ label1 Error TypeError: Type 'readonly int[]' is not compatible with type 'int[]' at index 1 */ -/* @@@ label Error TypeError: No matching call signature for foo(readonly int[]) */ +/* @@? 20:15 Error TypeError: No matching call signature for foo(Readonly>) */ +/* @@? 20:34 Error TypeError: Type 'Readonly>' is not compatible with type 'Array' at index 1 */ diff --git a/ets2panda/test/ast/parser/ets/readonly-parameter-test/Readonly-with-ArrayType-test4.ets b/ets2panda/test/ast/parser/ets/readonly-parameter-test/Readonly-with-ArrayType-test4.ets index 9a1945910..cf6bf40eb 100644 --- a/ets2panda/test/ast/parser/ets/readonly-parameter-test/Readonly-with-ArrayType-test4.ets +++ b/ets2panda/test/ast/parser/ets/readonly-parameter-test/Readonly-with-ArrayType-test4.ets @@ -18,4 +18,4 @@ function foo (x: Readonly) { let x1 : int[] x1 = /* @@ label */x } -/* @@@ label Error TypeError: Type 'readonly int[]' cannot be assigned to type 'int[]' */ +/* @@? 19:24 Error TypeError: Type 'Readonly>' cannot be assigned to type 'Array' */ diff --git a/ets2panda/test/ast/parser/ets/readonly-parameter-test/readonly-parameter-test3.ets b/ets2panda/test/ast/parser/ets/readonly-parameter-test/readonly-parameter-test3.ets index b99f61d26..125bd64c3 100644 --- a/ets2panda/test/ast/parser/ets/readonly-parameter-test/readonly-parameter-test3.ets +++ b/ets2panda/test/ast/parser/ets/readonly-parameter-test/readonly-parameter-test3.ets @@ -18,4 +18,4 @@ function foo (x: readonly int[]) { let x1 : int[] x1 = /* @@ label */x } -/* @@@ label Error TypeError: Type 'readonly int[]' cannot be assigned to type 'int[]' */ +/* @@? 19:24 Error TypeError: Type 'Readonly>' cannot be assigned to type 'Array' */ diff --git a/ets2panda/test/ast/parser/ets/readonly-parameter-test/readonly-parameter-test4.ets b/ets2panda/test/ast/parser/ets/readonly-parameter-test/readonly-parameter-test4.ets index c8f5c88c2..56c980492 100644 --- a/ets2panda/test/ast/parser/ets/readonly-parameter-test/readonly-parameter-test4.ets +++ b/ets2panda/test/ast/parser/ets/readonly-parameter-test/readonly-parameter-test4.ets @@ -19,5 +19,5 @@ function foo (p: int[]) { let x: readonly int[] = [] /* @@ label */foo(/* @@ label1 */x) -/* @@@ label1 Error TypeError: Type 'readonly int[]' is not compatible with type 'int[]' at index 1 */ -/* @@@ label Error TypeError: No matching call signature for foo(readonly int[]) */ +/* @@? 20:15 Error TypeError: No matching call signature for foo(Readonly>) */ +/* @@? 20:34 Error TypeError: Type 'Readonly>' is not compatible with type 'Array' at index 1 */ diff --git a/ets2panda/test/ast/parser/ets/recordIndexing.ets b/ets2panda/test/ast/parser/ets/recordIndexing.ets index 15b3ad58b..ff6f19bea 100644 --- a/ets2panda/test/ast/parser/ets/recordIndexing.ets +++ b/ets2panda/test/ast/parser/ets/recordIndexing.ets @@ -22,4 +22,6 @@ console.log(x[/* @@ label */0]) } -/* @@@ label Error TypeError: Cannot find index access method with the required signature. */ +/* @@? 23:17 Error TypeError: No matching indexing signature for $_get(int) */ +/* @@? 23:33 Error TypeError: Type 'int' is not compatible with type 'String' at index 1 */ +/* @@? 23:33 Error TypeError: Cannot find index access method with the required signature. */ diff --git a/ets2panda/test/ast/parser/ets/spreadArrayInTuple.ets b/ets2panda/test/ast/parser/ets/spreadArrayInTuple.ets index 07fdeb0ab..597d40da2 100644 --- a/ets2panda/test/ast/parser/ets/spreadArrayInTuple.ets +++ b/ets2panda/test/ast/parser/ets/spreadArrayInTuple.ets @@ -20,7 +20,7 @@ function main() { let y2: [boolean, int, string] = /* @@ label2 */[true, /* @@ label3 */...x2] } -/* @@@ label1 Error TypeError: '(Int|String)[]' cannot be spread in tuple. */ -/* @@@ label Error TypeError: Initializer has 1 elements, but tuple requires 2 */ -/* @@@ label3 Error TypeError: '(Int|String)[]' cannot be spread in tuple. */ -/* @@@ label2 Error TypeError: Initializer has 2 elements, but tuple requires 3 */ +/* @@? 18:43 Error TypeError: Initializer has 1 elements, but tuple requires 2 */ +/* @@? 18:59 Error TypeError: 'Array' cannot be spread in tuple. */ +/* @@? 20:53 Error TypeError: Initializer has 2 elements, but tuple requires 3 */ +/* @@? 20:75 Error TypeError: 'Array' cannot be spread in tuple. */ diff --git a/ets2panda/test/ast/parser/ets/trailing_comma_1.ets b/ets2panda/test/ast/parser/ets/trailing_comma_1.ets index e9576c826..0dad8cd6f 100644 --- a/ets2panda/test/ast/parser/ets/trailing_comma_1.ets +++ b/ets2panda/test/ast/parser/ets/trailing_comma_1.ets @@ -38,6 +38,7 @@ foo(,) /* @@? 16:30 Error SyntaxError: Rest parameter must be the last formal parameter. */ /* @@? 24:15 Error SyntaxError: Unexpected token, expected an identifier. */ /* @@? 24:15 Error SyntaxError: Parameter declaration should have an explicit type annotation. */ +/* @@? 28:9 Error TypeError: Expected type for array literal should be an array type, got *ERROR_TYPE* */ /* @@? 28:12 Error SyntaxError: Unexpected token ','. */ /* @@? 30:5 Error TypeError: Indexed access is not supported for such expression type. */ /* @@? 31:1 Error TypeError: No matching call signature for foo(a[0], a[1], ...a) */ diff --git a/ets2panda/test/ast/parser/ets/tuple_trailing_comma.ets b/ets2panda/test/ast/parser/ets/tuple_trailing_comma.ets index b04ad1f28..c2f305d2c 100644 --- a/ets2panda/test/ast/parser/ets/tuple_trailing_comma.ets +++ b/ets2panda/test/ast/parser/ets/tuple_trailing_comma.ets @@ -33,4 +33,5 @@ let b: [number, /* @@ label */,number, number,] = [1, 2, 3,]; /* @@? 17:35 Error SyntaxError: Unexpected token ']'. */ /* @@? 17:35 Error SyntaxError: Unexpected token ']'. */ /* @@? 17:37 Error SyntaxError: Unexpected token '='. */ +/* @@? 17:39 Error TypeError: Expected type for array literal should be an array type, got *ERROR_TYPE* */ /* @@? 18:31 Error SyntaxError: Invalid Type. */ diff --git a/ets2panda/test/ast/parser/ets/tuple_type_2_neg.ets b/ets2panda/test/ast/parser/ets/tuple_type_2_neg.ets index ce0fa517a..fb683c752 100644 --- a/ets2panda/test/ast/parser/ets/tuple_type_2_neg.ets +++ b/ets2panda/test/ast/parser/ets/tuple_type_2_neg.ets @@ -29,3 +29,4 @@ let a: [number, ...number[], number] = [1, 2, 3]; /* @@? 17:36 Error SyntaxError: Unexpected token ']'. */ /* @@? 17:36 Error SyntaxError: Unexpected token ']'. */ /* @@? 17:38 Error SyntaxError: Unexpected token '='. */ +/* @@? 17:40 Error TypeError: Expected type for array literal should be an array type, got *ERROR_TYPE* */ diff --git a/ets2panda/test/ast/parser/ets/tuple_type_3_neg.ets b/ets2panda/test/ast/parser/ets/tuple_type_3_neg.ets index f87b439b2..73f879b7f 100644 --- a/ets2panda/test/ast/parser/ets/tuple_type_3_neg.ets +++ b/ets2panda/test/ast/parser/ets/tuple_type_3_neg.ets @@ -22,6 +22,5 @@ let a: [number, number number] = [1, 2, 3]; /* @@? 17:30 Error SyntaxError: Unexpected token ']'. */ /* @@? 17:30 Error SyntaxError: Unexpected token ']'. */ /* @@? 17:30 Error SyntaxError: Unexpected token ']'. */ -/* @@? 17:30 Error SyntaxError: Unexpected token ']'. */ -/* @@? 17:30 Error SyntaxError: Unexpected token ']'. */ /* @@? 17:32 Error SyntaxError: Unexpected token '='. */ +/* @@? 17:34 Error TypeError: Expected type for array literal should be an array type, got *ERROR_TYPE* */ diff --git a/ets2panda/test/ast/parser/ets/tuple_type_4_neg.ets b/ets2panda/test/ast/parser/ets/tuple_type_4_neg.ets index 5d7524e82..1821a4335 100644 --- a/ets2panda/test/ast/parser/ets/tuple_type_4_neg.ets +++ b/ets2panda/test/ast/parser/ets/tuple_type_4_neg.ets @@ -29,3 +29,4 @@ let a: [a0: , a1: number] = [1, 2, 3]; /* @@? 17:25 Error SyntaxError: Unexpected token ']'. */ /* @@? 17:25 Error SyntaxError: Unexpected token ']'. */ /* @@? 17:27 Error SyntaxError: Unexpected token '='. */ +/* @@? 17:29 Error TypeError: Expected type for array literal should be an array type, got *ERROR_TYPE* */ diff --git a/ets2panda/test/ast/parser/ets/type_argument_conversion.ets b/ets2panda/test/ast/parser/ets/type_argument_conversion.ets index 0469cda02..df134478d 100644 --- a/ets2panda/test/ast/parser/ets/type_argument_conversion.ets +++ b/ets2panda/test/ast/parser/ets/type_argument_conversion.ets @@ -30,11 +30,11 @@ function main(): int { return 0; } -/* @@? 29:38 Error TypeError: No Matching Parameterless Constructor, parameter count 1 */ -/* @@? 29:38 Error TypeError: No matching parameterless constructor */ -/* @@? 29:38 Error TypeError: Signature is not available here. */ -/* @@? 29:38 Error TypeError: Type 'A[]' is not compatible with type 'A[]' at index 1 */ -/* @@? 29:38 Error TypeError: No Matching Parameterless Constructor, parameter count 1 */ -/* @@? 29:38 Error TypeError: No matching parameterless constructor */ -/* @@? 29:38 Error TypeError: Signature is not available here. */ -/* @@? 29:24 Error TypeError: No matching construct signature for type_argument_conversion.A(A[]) */ +/* @@? 29:24 Error TypeError: No matching construct signature for type_argument_conversion.A(Array>) */ +/* @@? 29:38 Error TypeError: No Matching Parameterless Constructor, parameter count 1 */ +/* @@? 29:38 Error TypeError: No matching parameterless constructor */ +/* @@? 29:38 Error TypeError: Signature is not available here. */ +/* @@? 29:38 Error TypeError: Type 'Array>' is not compatible with type 'Array>' at index 1 */ +/* @@? 29:38 Error TypeError: No Matching Parameterless Constructor, parameter count 1 */ +/* @@? 29:38 Error TypeError: No matching parameterless constructor */ +/* @@? 29:38 Error TypeError: Signature is not available here. */ diff --git a/ets2panda/test/ast/parser/ets/unexpected_token_42.ets b/ets2panda/test/ast/parser/ets/unexpected_token_42.ets index 13d4a9c28..ca529c792 100644 --- a/ets2panda/test/ast/parser/ets/unexpected_token_42.ets +++ b/ets2panda/test/ast/parser/ets/unexpected_token_42.ets @@ -15,5 +15,5 @@ // Int[1,2,3,4,5] let a: number = new Int[1 -/* @@? 16:17 Error TypeError: Type 'Int[]' cannot be assigned to type 'double' */ +/* @@? 16:17 Error TypeError: Type 'FixedArray' cannot be assigned to type 'double' */ /* @@? 20:1 Error SyntaxError: Expected ']', got 'eos'. */ diff --git a/ets2panda/test/ast/parser/ets/unexpected_token_47.ets b/ets2panda/test/ast/parser/ets/unexpected_token_47.ets index 9eda4e7bc..7054ba549 100644 --- a/ets2panda/test/ast/parser/ets/unexpected_token_47.ets +++ b/ets2panda/test/ast/parser/ets/unexpected_token_47.ets @@ -15,7 +15,7 @@ let isPrime: int[] = new int[[]][[] -/* @@? 16:22 Error TypeError: Type 'int[][]' cannot be assigned to type 'int[]' */ +/* @@? 16:22 Error TypeError: Type 'Array>' cannot be assigned to type 'Array' */ /* @@? 16:30 Error TypeError: Can't resolve array type */ /* @@? 16:34 Error TypeError: Can't resolve array type */ /* @@? 22:1 Error SyntaxError: Expected ']', got 'eos'. */ diff --git a/ets2panda/test/ast/parser/ets/wrong-union-array-assignment.ets b/ets2panda/test/ast/parser/ets/wrong-union-array-assignment.ets index ead13d299..90dddc19e 100644 --- a/ets2panda/test/ast/parser/ets/wrong-union-array-assignment.ets +++ b/ets2panda/test/ast/parser/ets/wrong-union-array-assignment.ets @@ -24,4 +24,4 @@ function main() array = /* @@ label */new Bad(); } -/* @@@ label Error TypeError: Type 'Bad' cannot be assigned to type '(Int|Double|String)[]' */ +/* @@? 24:27 Error TypeError: Type 'Bad' cannot be assigned to type 'Array' */ -- Gitee