diff --git a/ets2panda/parser/TypedParser.cpp b/ets2panda/parser/TypedParser.cpp index 6053a4322669f807c6c87c4759545b54813ab6d5..e66067b2874846ff249d94f453426bd547d604a3 100644 --- a/ets2panda/parser/TypedParser.cpp +++ b/ets2panda/parser/TypedParser.cpp @@ -1260,6 +1260,7 @@ ir::AstNode *TypedParser::ParseTypeParameterInstantiationImpl(TypeAnnotationPars TypeAnnotationParsingOptions tmpOptions = *options &= ~TypeAnnotationParsingOptions::IGNORE_FUNCTION_TYPE; // Need to parse correctly the cases like `x: T|C` tmpOptions &= ~TypeAnnotationParsingOptions::DISALLOW_UNION; + tmpOptions |= TypeAnnotationParsingOptions::ANNOTATION_NOT_ALLOW; ir::TypeNode *currentParam = ParseTypeAnnotation(&tmpOptions); if (currentParam == nullptr) { diff --git a/ets2panda/test/ast/compiler/ets/FixedArray/most_specific_method_with_empty_rest_param.ets b/ets2panda/test/ast/compiler/ets/FixedArray/most_specific_method_with_empty_rest_param.ets index ba8226128ab860ae9c64be9eb88376229fbb3a85..e53edf414f6b30acaca6e1866c99198e6b8b1df5 100644 --- a/ets2panda/test/ast/compiler/ets/FixedArray/most_specific_method_with_empty_rest_param.ets +++ b/ets2panda/test/ast/compiler/ets/FixedArray/most_specific_method_with_empty_rest_param.ets @@ -26,6 +26,3 @@ function main() { let c: C = new C() c.met() } - -/* @@? 27:5 Error TypeError: Call to `met` is ambiguous */ -/* @@? 27:5 Error TypeError: Reference to met is ambiguous */ diff --git a/ets2panda/test/ast/compiler/ets/annotation_tests/annotation_for_type_parameter02.ets b/ets2panda/test/ast/compiler/ets/annotation_tests/annotation_for_type_parameter02.ets index e3bb5eb3fb1b85806e7e13956f08bf0f391c32b3..b5c78bbd979d77f371f35688c0b17bb05e2111d9 100644 --- a/ets2panda/test/ast/compiler/ets/annotation_tests/annotation_for_type_parameter02.ets +++ b/ets2panda/test/ast/compiler/ets/annotation_tests/annotation_for_type_parameter02.ets @@ -27,13 +27,13 @@ class A{ function foo(){} foo<@Anno T>() -/* @@? 17:27 Error SyntaxError: Annotations are not allowed on this type of declaration. */ -/* @@? 17:52 Error SyntaxError: Annotations are not allowed on this type of declaration. */ -/* @@? 22:17 Error SyntaxError: Annotations are not allowed on this type of declaration. */ -/* @@? 22:17 Error SyntaxError: Annotations are not allowed on this type of declaration. */ -/* @@? 23:22 Error SyntaxError: Annotations are not allowed on this type of declaration. */ -/* @@? 28:11 Error SyntaxError: Annotations are not allowed on this type of declaration. */ -/* @@? 28:11 Error SyntaxError: Annotations are not allowed on this type of declaration. */ -/* @@? 28:11 Error TypeError: Cannot find type 'T'. */ +/* @@? 17:27 Error SyntaxError: Annotations are not allowed on this type of declaration. */ +/* @@? 17:52 Error SyntaxError: Annotations are not allowed on this type of declaration. */ +/* @@? 22:17 Error SyntaxError: Annotations are not allowed on this type of declaration. */ +/* @@? 22:17 Error SyntaxError: Annotations are not allowed on this type of declaration. */ /* @@? 22:17 Error TypeError: Cannot find type 'T'. */ +/* @@? 23:22 Error SyntaxError: Annotations are not allowed on this type of declaration. */ /* @@? 23:22 Error TypeError: Cannot find type 'T'. */ +/* @@? 28:11 Error SyntaxError: Annotations are not allowed on this type of declaration. */ +/* @@? 28:11 Error SyntaxError: Annotations are not allowed on this type of declaration. */ +/* @@? 28:11 Error TypeError: Cannot find type 'T'. */ diff --git a/ets2panda/test/ast/compiler/ets/extension_function_tests/extension_function_duplicated_with_private_field.ets b/ets2panda/test/ast/compiler/ets/extension_function_tests/extension_function_duplicated_with_private_field.ets index a40c3a1069bf44d9132e8496caa134cbb684b294..768d82a696361b8c07a502c9b7e8226cd0f6174f 100644 --- a/ets2panda/test/ast/compiler/ets/extension_function_tests/extension_function_duplicated_with_private_field.ets +++ b/ets2panda/test/ast/compiler/ets/extension_function_tests/extension_function_duplicated_with_private_field.ets @@ -28,4 +28,6 @@ function main() { console.println(/* @@label */banana.name(2)); } -/* @@@ label Error TypeError: No matching call signature for name(int) */ +/* @@? 28:34 Error TypeError: Signature name(=t: Banana, id: int): int is not visible here. */ +/* @@? 28:34 Error TypeError: No matching call signature for name(Banana, int) */ +/* @@? 28:34 Error TypeError: No matching call signature for name(int) */ diff --git a/ets2panda/test/ast/compiler/ets/inferTypeOfArrayNegative3.ets b/ets2panda/test/ast/compiler/ets/inferTypeOfArrayNegative3.ets index 4a568f118d26826ea71cea35b777fd30d07a562f..5856063ea2e162016e81d70f12f2e953976bc615 100644 --- a/ets2panda/test/ast/compiler/ets/inferTypeOfArrayNegative3.ets +++ b/ets2panda/test/ast/compiler/ets/inferTypeOfArrayNegative3.ets @@ -16,4 +16,5 @@ let a = [1, 2, 3] a[0] = /* @@ label */"1" -/* @@@ label Error TypeError: Type '"1"' cannot be assigned to type 'double' */ +/* @@? 17:1 Error TypeError: No matching indexing signature for $_set(int, "1") */ +/* @@? 17:3 Error TypeError: Cannot find index access method with the required signature. */ diff --git a/ets2panda/test/ast/compiler/ets/lambda_short.ets b/ets2panda/test/ast/compiler/ets/lambda_short.ets index d57eb421b4a2ff5f97d835a50ee7b6bb661a5a91..e891be27576d743e379d3181dbfee4d60af70ffb 100644 --- a/ets2panda/test/ast/compiler/ets/lambda_short.ets +++ b/ets2panda/test/ast/compiler/ets/lambda_short.ets @@ -14,6 +14,6 @@ */ function main(): void { - let nums: int[] = [ 1, 2, 3, 123, 321 ] + let nums: FixedArray = [ 1, 2, 3, 123, 321 ] forEach(nums, num => console.log(num)) } diff --git a/ets2panda/test/ast/compiler/ets/setArrayLength1.ets b/ets2panda/test/ast/compiler/ets/setArrayLength1.ets index efbc6f2a47ed4afc1b46a489eef90689a96360f4..2362ec8e7c8d72d5abaafc87ba005e7af8b23359 100644 --- a/ets2panda/test/ast/compiler/ets/setArrayLength1.ets +++ b/ets2panda/test/ast/compiler/ets/setArrayLength1.ets @@ -21,5 +21,3 @@ function main(): void { let test_var = new TestClass(); /* @@ label */test_var.test_array.length = 0; } - -/* @@@ label Error TypeError: Setting the length of an array is not permitted */ diff --git a/ets2panda/test/ast/compiler/ets/setArrayLength2.ets b/ets2panda/test/ast/compiler/ets/setArrayLength2.ets index 30fec02a972b8a0ac7e25b5e2b3fbd1aa4a4326c..fe0140ea69d6b5860c8690776489efb02cc51f2d 100644 --- a/ets2panda/test/ast/compiler/ets/setArrayLength2.ets +++ b/ets2panda/test/ast/compiler/ets/setArrayLength2.ets @@ -17,5 +17,3 @@ function main(): void { let test_array: int[] = [1, 2, 3]; /* @@ label */test_array.length = 0; } - -/* @@@ label Error TypeError: Setting the length of an array is not permitted */ diff --git a/ets2panda/test/ast/compiler/ets/setArrayLength3.ets b/ets2panda/test/ast/compiler/ets/setArrayLength3.ets index 43bb76acf3b94d52f5365960359082a1d17d4650..860ed277380b381acc4b481525ae1637d0d3985f 100644 --- a/ets2panda/test/ast/compiler/ets/setArrayLength3.ets +++ b/ets2panda/test/ast/compiler/ets/setArrayLength3.ets @@ -17,5 +17,3 @@ function main(): void { let test_array: int[] = [1, 2, 3] /* @@ label */test_array.length += 1 } - -/* @@@ label Error TypeError: Setting the length of an array is not permitted */ diff --git a/ets2panda/test/ast/parser/ets/FixedArray/for_of_02.ets b/ets2panda/test/ast/parser/ets/FixedArray/for_of_02.ets index b5811a66f5d7fc3dbb31dd0dab0c422404e172e2..fd74b049d9cf1f7fa1811afceca01c352bfc419e 100644 --- a/ets2panda/test/ast/parser/ets/FixedArray/for_of_02.ets +++ b/ets2panda/test/ast/parser/ets/FixedArray/for_of_02.ets @@ -32,4 +32,4 @@ function main(): void { } } -/* @@@ label Error TypeError: Source element type 'double' is not assignable to the loop iterator type 'float'. */ +/* @@? 30:17 Error TypeError: Source element type 'Double' is not assignable to the loop iterator type 'float'. */ diff --git a/ets2panda/test/ast/parser/ets/FixedArray/illegal_union_member_exp.ets b/ets2panda/test/ast/parser/ets/FixedArray/illegal_union_member_exp.ets index 5267d9b7a5991204ceb7126c7f3c1b47da829788..b1a0358ee7b6d53a3bab8f269d866c79d336f054 100644 --- a/ets2panda/test/ast/parser/ets/FixedArray/illegal_union_member_exp.ets +++ b/ets2panda/test/ast/parser/ets/FixedArray/illegal_union_member_exp.ets @@ -23,4 +23,4 @@ function main(): void { } /* @@? 22:19 Error TypeError: Member type must be the same for all union objects. */ -/* @@? 22:19 Error TypeError: Type String|int[] is illegal in union member expression. */ +/* @@? 22:19 Error TypeError: Member type must be the same for all union objects. */ \ No newline at end of file diff --git a/ets2panda/test/ast/parser/ets/InvalidExpressions1.ets b/ets2panda/test/ast/parser/ets/InvalidExpressions1.ets index 72316999b9d5a269d4916313f7ad5e702584fd67..7f4a5b0ae83377683dbb45be91b67ea06bcae46f 100644 --- a/ets2panda/test/ast/parser/ets/InvalidExpressions1.ets +++ b/ets2panda/test/ast/parser/ets/InvalidExpressions1.ets @@ -36,8 +36,7 @@ function f(x: int): void { a?.[1+2); let a = [1, 2, 3); -// This line should be the last line to correctly test closing brace. - +/* @@? 16:9 Error TypeError: Expected type for array literal should be an array type, got *ERROR_TYPE* */ /* @@? 16:16 Error SyntaxError: Unexpected token ','. */ /* @@? 18:3 Error SyntaxError: Unexpected token, expected ',' or ']'. */ /* @@? 18:3 Error SyntaxError: Unexpected token '...'. */ @@ -64,12 +63,12 @@ let a = [1, 2, 3); /* @@? 24:5 Error TypeError: Variable 'a' has already been declared. */ /* @@? 24:18 Error TypeError: The type of parameter 'y' cannot be inferred */ /* @@? 24:18 Error TypeError: The type of parameter 'y' cannot be inferred */ +/* @@? 24:19 Error SyntaxError: Unexpected token, expected ',' or ')'. */ +/* @@? 24:19 Error SyntaxError: Expected '=>', got '...'. */ /* @@? 24:19 Error SyntaxError: Unexpected token '...'. */ /* @@? 24:19 Error SyntaxError: Unexpected token '...'. */ /* @@? 24:19 Error SyntaxError: Unexpected token '...'. */ /* @@? 24:19 Error SyntaxError: Unexpected token '...'. */ -/* @@? 24:19 Error SyntaxError: Expected '=>', got '...'. */ -/* @@? 24:19 Error SyntaxError: Unexpected token, expected ',' or ')'. */ /* @@? 24:22 Error SyntaxError: Unexpected token ','. */ /* @@? 24:22 Error SyntaxError: Unexpected token ','. */ /* @@? 24:24 Error SyntaxError: Unexpected token ')'. */ @@ -79,12 +78,13 @@ let a = [1, 2, 3); /* @@? 24:27 Error TypeError: The type of parameter 'void' cannot be inferred */ /* @@? 26:7 Error SyntaxError: Unexpected token '||='. */ /* @@? 28:5 Error TypeError: Variable 'a' has already been declared. */ -/* @@? 28:16 Error TypeError: Bad operand type, the types of the operands must be numeric type, enum or String. */ /* @@? 28:20 Error SyntaxError: Expected '}', got ')'. */ /* @@? 30:5 Error TypeError: Variable 'a' has already been declared. */ -/* @@? 30:13 Error SyntaxError: Import declarations can only be used on the top level and before any other declaration, top level statement or directive. */ /* @@? 30:13 Error SyntaxError: Unexpected token 'import'. */ /* @@? 30:13 Error SyntaxError: Invalid Type. */ +/* @@? 30:13 Error SyntaxError: Import declarations can only be used on the top level and before any other declaration, top level statement or directive. */ +/* @@? 30:13 Error SyntaxError: Unexpected token 'import'. */ +/* @@? 30:13 Error SyntaxError: Unexpected token 'import'. */ /* @@? 32:10 Error TypeError: Variable 'f' has already been declared. */ /* @@? 32:10 Error TypeError: Variable 'f' has already been declared. */ /* @@? 33:5 Error TypeError: No matching call signature for std.core.Object(int) */ @@ -94,7 +94,8 @@ let a = [1, 2, 3); /* @@? 36:1 Error TypeError: Indexed access is not supported for such expression type. */ /* @@? 36:8 Error SyntaxError: Unexpected token, expected ']'. */ /* @@? 38:5 Error TypeError: Variable 'a' has already been declared. */ +/* @@? 38:9 Error TypeError: Expected type for array literal should be an array type, got *ERROR_TYPE* */ +/* @@? 38:17 Error SyntaxError: Unexpected token, expected ',' or ']'. */ /* @@? 38:17 Error SyntaxError: Unexpected token ')'. */ /* @@? 38:17 Error SyntaxError: Unexpected token ')'. */ /* @@? 38:17 Error SyntaxError: Unexpected token ')'. */ -/* @@? 38:17 Error SyntaxError: Unexpected token, expected ',' or ']'. */ diff --git a/ets2panda/test/ast/parser/ets/arrAsArray.ets b/ets2panda/test/ast/parser/ets/arrAsArray.ets index 707bb0952710a9c3fb98a78fdec1b1493de0a1ba..4422772546899cb93ca70cf28acbbb04e5d250d2 100644 --- a/ets2panda/test/ast/parser/ets/arrAsArray.ets +++ b/ets2panda/test/ast/parser/ets/arrAsArray.ets @@ -19,5 +19,3 @@ function main() { 2, 3, 5, 7, 11 ] as Array } - -/* @@@ label Error TypeError: Expected type for array literal should be an array type, got Array */ diff --git a/ets2panda/test/ast/parser/ets/enum10.ets b/ets2panda/test/ast/parser/ets/enum10.ets index 7afc83c3a6c38d1ce374a6f15f6e1e1ad69f7855..9a31b18a0a43cc6f0da23e269b695b73fc21cad7 100644 --- a/ets2panda/test/ast/parser/ets/enum10.ets +++ b/ets2panda/test/ast/parser/ets/enum10.ets @@ -16,7 +16,7 @@ enum Color { Red } function main(): void { - let values: Color[] = Color.values(); + let values: FixedArray = Color.values(); // Note(daizihan): values() becomes static method in enum, so no CTE - let valuesFail: Color[] = values[0].values(); + let valuesFail: FixedArray = values[0].values(); } diff --git a/ets2panda/test/ast/parser/ets/for_of_02.ets b/ets2panda/test/ast/parser/ets/for_of_02.ets index 2488cf4cd9b1e7557335954ae067d5354d5e7a93..536a743db6e3e7c30125b2e7099a80d43d4c9aac 100644 --- a/ets2panda/test/ast/parser/ets/for_of_02.ets +++ b/ets2panda/test/ast/parser/ets/for_of_02.ets @@ -32,4 +32,4 @@ function main(): void { } } -/* @@@ label Error TypeError: Source element type 'double' is not assignable to the loop iterator type 'float'. */ +/* @@? 30:17 Error TypeError: Source element type 'Double' is not assignable to the loop iterator type 'float'. */ diff --git a/ets2panda/test/ast/parser/ets/for_of_loop_variable.ets b/ets2panda/test/ast/parser/ets/for_of_loop_variable.ets index 8b89ebd4efc3e186a7fafa53fcff6e99e252254c..167d3297a19d4909e7ac1081109bba1a9d70224a 100644 --- a/ets2panda/test/ast/parser/ets/for_of_loop_variable.ets +++ b/ets2panda/test/ast/parser/ets/for_of_loop_variable.ets @@ -30,7 +30,7 @@ for (let value = 40 /* @@ label2 */of iterable2) { console.log(value); } -/* @@@ label1 Error SyntaxError: for-of loop variable declaration may not have an initializer. */ -/* @@@ label2 Error SyntaxError: for-of loop variable declaration may not have an initializer. */ -/* @@? 18:1 Error TypeError: Source element type 'double' is not assignable to the loop iterator type 'int'. */ -/* @@? 28:1 Error TypeError: Source element type 'double' is not assignable to the loop iterator type 'int'. */ +/* @@? 18:1 Error TypeError: Source element type 'Double' is not assignable to the loop iterator type 'int'. */ +/* @@? 18:38 Error SyntaxError: for-of loop variable declaration may not have an initializer. */ +/* @@? 28:1 Error TypeError: Source element type 'Double' is not assignable to the loop iterator type 'int'. */ +/* @@? 28:36 Error SyntaxError: for-of loop variable declaration may not have an initializer. */ diff --git a/ets2panda/test/ast/parser/ets/illegal_union_member_exp.ets b/ets2panda/test/ast/parser/ets/illegal_union_member_exp.ets index ceba1bde64379296644943ed904b8dac63d2a2cc..e9f30a241c43a7c3b5b341ed1c12a37ee7ff3722 100644 --- a/ets2panda/test/ast/parser/ets/illegal_union_member_exp.ets +++ b/ets2panda/test/ast/parser/ets/illegal_union_member_exp.ets @@ -22,5 +22,5 @@ function main(): void { /* @@ label */b.toString(); } -/* @@@ label Error TypeError: Member type must be the same for all union objects. */ -/* @@@ label Error TypeError: Type String|int[] is illegal in union member expression. */ +/* @@? 22:19 Error TypeError: Member type must be the same for all union objects. */ +/* @@? 22:19 Error TypeError: Member type must be the same for all union objects. */ \ No newline at end of file diff --git a/ets2panda/test/ast/parser/ets/nonIntegralIndex.ets b/ets2panda/test/ast/parser/ets/nonIntegralIndex.ets index 1d7295d53c26d921d22f94e6613a6f0256535053..99ae69249a09d175981d11fc64d01228597eae4c 100644 --- a/ets2panda/test/ast/parser/ets/nonIntegralIndex.ets +++ b/ets2panda/test/ast/parser/ets/nonIntegralIndex.ets @@ -18,5 +18,3 @@ export class Test { u[/* @@ label */i] = 0.0 } } - -/* @@@ label Error TypeError: Type 'double' cannot be used as an index type. Only primitive or unboxable integral types can be used as index. */