diff --git a/ets2panda/test/ast/compiler/ets/errors/syntax/escape_sequences.ets b/ets2panda/test/ast/compiler/ets/errors/syntax/escape_sequences.ets new file mode 100644 index 0000000000000000000000000000000000000000..150afd3cac0fc9a82688d88eee63813b03321d92 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/errors/syntax/escape_sequences.ets @@ -0,0 +1,19 @@ +/* + * 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. + */ + +awa\u{0069}t + +/* @@? 16:1 Error SyntaxError: Escape sequences are not allowed in keyword. */ +/* @@? 16:1 Error TypeError: Unresolved reference await */ diff --git a/ets2panda/test/ast/compiler/ets/errors/syntax/invalid_left_side_array_destructuring.ets b/ets2panda/test/ast/compiler/ets/errors/syntax/invalid_left_side_array_destructuring.ets new file mode 100644 index 0000000000000000000000000000000000000000..0b01f1bb9471290796dcb381ffc345eef8220ef7 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/errors/syntax/invalid_left_side_array_destructuring.ets @@ -0,0 +1,21 @@ +/* + * 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. + */ + +({...a, b} =) + +/* @@? 16:2 Error SyntaxError: Invalid left-hand side in array destructuring pattern. */ +/* @@? 16:2 Error TypeError: need to specify target type for class composite */ +/* @@? 16:2 Error TypeError: Invalid left-hand side of assignment expression */ +/* @@? 16:13 Error SyntaxError: Unexpected token ')'. */ diff --git a/ets2panda/test/ast/compiler/ets/errors/syntax/invalid_num.ets b/ets2panda/test/ast/compiler/ets/errors/syntax/invalid_num.ets new file mode 100644 index 0000000000000000000000000000000000000000..6409d3ee87f76ec6c40cac829050836479fc9f81 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/errors/syntax/invalid_num.ets @@ -0,0 +1,19 @@ + +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +let num: int = 2147483648888888888888888888888888888888888888888888888888888888888888888888888888888888888 + +/* @@? 17:16 Error SyntaxError: Invalid number. */ diff --git a/ets2panda/test/ast/compiler/ets/errors/syntax/required_param_after_default.ets b/ets2panda/test/ast/compiler/ets/errors/syntax/required_param_after_default.ets new file mode 100644 index 0000000000000000000000000000000000000000..3e48df87a47945a6660c8615867aed0be49eddaa --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/errors/syntax/required_param_after_default.ets @@ -0,0 +1,27 @@ +/* + * 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. + */ + +class testEntry { + value: number; + + constructor(x: number, y?: number, /* @@ label */z: number) { + this.value = x; + } +} + +let entry = new testEntry(1, 2, 3); + +/* @@@ label Error SyntaxError: A required parameter cannot follow an optional parameter. */ +/* @@@ label Error SyntaxError: Required parameter follows default parameter(s). */ diff --git a/ets2panda/test/ast/compiler/ets/errors/syntax/rest_param_last.ets b/ets2panda/test/ast/compiler/ets/errors/syntax/rest_param_last.ets new file mode 100644 index 0000000000000000000000000000000000000000..408f825ad9cb4b41f56eafa8d40974245559b8d8 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/errors/syntax/rest_param_last.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +let lam = (...num: number[]/* @@ label1 */, /* @@ label2 */p/* @@ label3 */: /* @@ label4 */string = "default"/* @@ label5 */) /* @@ label6 */=> {} + +/* @@@ label1 Error SyntaxError: Rest parameter must be the last formal parameter.*/ +/* @@@ label2 Error SyntaxError: Expected '=>', got 'identification literal'. */ +/* @@@ label2 Error TypeError: Unresolved reference p */ +/* @@@ label3 Error SyntaxError: Unexpected token ':'. */ +/* @@@ label3 Error SyntaxError: Unexpected token ':'. */ +/* @@@ label3 Error SyntaxError: Unexpected token ':'. */ +/* @@@ label4 Error TypeError: Type name 'string' used in the wrong context */ +/* @@@ label5 Error SyntaxError: Unexpected token ')'. */ +/* @@@ label5 Error SyntaxError: Unexpected token ')'. */ +/* @@@ label5 Error SyntaxError: Unexpected token ')'. */ +/* @@@ label6 Error SyntaxError: Unexpected token '=>'. */ +/* @@@ label6 Error SyntaxError: Unexpected token '=>'. */ diff --git a/ets2panda/test/ast/compiler/ets/errors/type/annot_multiple_field.ets b/ets2panda/test/ast/compiler/ets/errors/type/annot_multiple_field.ets new file mode 100644 index 0000000000000000000000000000000000000000..7139302975f44061c15f1a1df00fd02ea78008fc --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/errors/type/annot_multiple_field.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. + */ + +@interface deprecated { + fromVersion: string + endVersion: string +} + +@/* @@ label */deprecated("5.18") +function foo() {} + +/* @@@ label Error TypeError: Annotation 'deprecated' requires multiple fields to be specified. */ diff --git a/ets2panda/test/ast/compiler/ets/errors/type/cannot_cast_null_or_undefined_to_non_nullish_type.ets b/ets2panda/test/ast/compiler/ets/errors/type/cannot_cast_null_or_undefined_to_non_nullish_type.ets new file mode 100644 index 0000000000000000000000000000000000000000..a99cf542aa30cf2518c6ed39fa6164de2fee35a1 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/errors/type/cannot_cast_null_or_undefined_to_non_nullish_type.ets @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +let entry: undefined = undefined; +/* @@ label */entry as string; + +/* @@@ label Error TypeError: Cannot cast 'null' or 'undefined' to non-nullish type. */ diff --git a/ets2panda/test/ast/compiler/ets/errors/type/cannot_reassign.ets b/ets2panda/test/ast/compiler/ets/errors/type/cannot_reassign.ets new file mode 100644 index 0000000000000000000000000000000000000000..97df9232147867bfe54fc580b13a9d93aa354b9b --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/errors/type/cannot_reassign.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. + */ + +const /* @@ label */entry: number = 11; + +class testEntry { + constructor() { + entry = 22; + } +} + +/* @@@ label Error TypeError: Cannot reassign constant entry */ diff --git a/ets2panda/test/ast/compiler/ets/errors/type/cast_to_never_prohibited.ets b/ets2panda/test/ast/compiler/ets/errors/type/cast_to_never_prohibited.ets new file mode 100644 index 0000000000000000000000000000000000000000..e565130a2dc2f96c9ae7bbf37ceb473207f2ec8e --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/errors/type/cast_to_never_prohibited.ets @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +let entry: string = 'undefined'; +/* @@ label */entry as never; + +/* @@@ label Error TypeError: Cast to 'never' is prohibited */ diff --git a/ets2panda/test/ast/compiler/ets/errors/type/conflicting_generic_interface_impls.ets b/ets2panda/test/ast/compiler/ets/errors/type/conflicting_generic_interface_impls.ets new file mode 100644 index 0000000000000000000000000000000000000000..f836c53d6496e676309e5292e711ed1af07d9ead --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/errors/type/conflicting_generic_interface_impls.ets @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +interface A { +} + +class B implements A, /* @@ label */A { + +} + +/* @@@ label Error TypeError: Implements generic interface 'A' with different instantiations. */ diff --git a/ets2panda/test/ast/compiler/ets/errors/type/ctor_ref_invalid_ctx_global.ets b/ets2panda/test/ast/compiler/ets/errors/type/ctor_ref_invalid_ctx_global.ets new file mode 100644 index 0000000000000000000000000000000000000000..530bd88f647291a1e3a92f7c988980b8804e4ba8 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/errors/type/ctor_ref_invalid_ctx_global.ets @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +function method() { + let a = () => { + console.println(/* @@ label */this./* @@ label1 */prop) + } +} + +/* @@@ label Error TypeError: Cannot reference 'this' in this context. */ +/* @@@ label1 Error TypeError: Property 'prop' does not exist on type 'Error' */ diff --git a/ets2panda/test/ast/compiler/ets/errors/type/exception_redeclaration.ets b/ets2panda/test/ast/compiler/ets/errors/type/exception_redeclaration.ets new file mode 100644 index 0000000000000000000000000000000000000000..4a93bbea0c0ac0ecbdbfeec360ca9195d6bd2dd8 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/errors/type/exception_redeclaration.ets @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +function main(): void { + try { + } catch (e: Exception) { + } catch (e: Exception) { + } +} + +/* @@? 19:7 Error TypeError: Redeclaration of exception type */ diff --git a/ets2panda/test/ast/compiler/ets/errors/type/instanceof_nonobject.ets b/ets2panda/test/ast/compiler/ets/errors/type/instanceof_nonobject.ets new file mode 100644 index 0000000000000000000000000000000000000000..a8a89afa9a32dd90acbdabe93938f80f71314819 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/errors/type/instanceof_nonobject.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. + */ + +class Frog { + sleep() {}; + leap() {}; +} +let animal: int; +if (animal instanceof Frog) { +} + +/* @@? 21:5 Error TypeError: Using the 'instance of' operator with non-object type 'animal' */ diff --git a/ets2panda/test/ast/compiler/ets/errors/type/invalid_const_assignment.ets b/ets2panda/test/ast/compiler/ets/errors/type/invalid_const_assignment.ets new file mode 100644 index 0000000000000000000000000000000000000000..42671fc6338df6ce5e2afcb97cfb6fa0743f0553 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/errors/type/invalid_const_assignment.ets @@ -0,0 +1,21 @@ +/* + * 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. + */ + +const /* @@ label1 */materials = "hydrogen" + +materials = /* @@ label2 */"oxydrogen" + +/* @@@ label1 Error TypeError: Cannot assign to a constant variable materials */ +/* @@@ label2 Error TypeError: Type '"oxydrogen"' cannot be assigned to type '"hydrogen"' */ diff --git a/ets2panda/test/ast/compiler/ets/errors/type/invalid_readonly_assignment.ets b/ets2panda/test/ast/compiler/ets/errors/type/invalid_readonly_assignment.ets new file mode 100644 index 0000000000000000000000000000000000000000..fb035410fd34ee1e158298da15191e8c42daafed --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/errors/type/invalid_readonly_assignment.ets @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +class T { + readonly /* @@ label */materials = "hydrogen" +} + +let t: T; +t.materials = "oxydrogen" + +/* @@@ label Error TypeError: Cannot assign to a readonly variable materials */ diff --git a/ets2panda/test/ast/compiler/ets/errors/type/local_class_invalid_ctx.ets b/ets2panda/test/ast/compiler/ets/errors/type/local_class_invalid_ctx.ets new file mode 100644 index 0000000000000000000000000000000000000000..48a7d5b772afc0ef9f63718a97670eca89dfd087 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/errors/type/local_class_invalid_ctx.ets @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +let arg = '1'; + +function foo () { + switch(arg) { + case '1': + class LocalClass /* @@ label */{} + } +} + +/* @@@ label Error TypeError: Local classes must be defined between balanced braces */ diff --git a/ets2panda/test/ast/compiler/ets/errors/type/postcond_failed.ets b/ets2panda/test/ast/compiler/ets/errors/type/postcond_failed.ets new file mode 100644 index 0000000000000000000000000000000000000000..bf8016ffe3ed0b59ca18c2bfa8708cb6aea105bf --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/errors/type/postcond_failed.ets @@ -0,0 +1,20 @@ +/* + * 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 f3(a: int = /* @@ label*/): void; + +/* @@@ label Error TypeError: Postcondition check failed for DefaultParametersLowering */ +/* @@@ label Error SyntaxError: You didn't set the value. */ +/* @@@ label Error SyntaxError: Unexpected token ')'. */ \ No newline at end of file diff --git a/ets2panda/test/ast/compiler/ets/errors/type/read_from_writeonly_prop.ets b/ets2panda/test/ast/compiler/ets/errors/type/read_from_writeonly_prop.ets new file mode 100644 index 0000000000000000000000000000000000000000..9dbbca0128f5a809e9077fe1722d6b190355790a --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/errors/type/read_from_writeonly_prop.ets @@ -0,0 +1,26 @@ +/* + * 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. + */ + +class A { + private _filed: number = 1; + set filed(value: number) { + this._filed = value; + } +} + +let instance = new A(); +instance./* @@ label */filed; + +/* @@@ label Error TypeError: Cannot read from this property because it is writeonly. */ diff --git a/ets2panda/test/ast/compiler/ets/errors/type/repeated_interface.ets b/ets2panda/test/ast/compiler/ets/errors/type/repeated_interface.ets new file mode 100644 index 0000000000000000000000000000000000000000..2ec5908e3c999b6663c4a92f78b1da8520aef2cf --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/errors/type/repeated_interface.ets @@ -0,0 +1,20 @@ +/* + * 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. + */ + +interface A {} + +class B implements A, /* @@ label */A {} + +/* @@@ label Error TypeError: Repeated interface. */ diff --git a/ets2panda/test/ast/compiler/ets/errors/type/rtype_param_count_mismatch.ets b/ets2panda/test/ast/compiler/ets/errors/type/rtype_param_count_mismatch.ets new file mode 100644 index 0000000000000000000000000000000000000000..3747a11bdae385335f4417d61e4eeb7a30c4d71e --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/errors/type/rtype_param_count_mismatch.ets @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +function foo (a: X, b: T) { + return; +} + +/* @@ label */foo("a", "b"); + +/* @@@ label Error TypeError: Expected 2 type arguments, got 1 . */ +/* @@@ label Error TypeError: No matching call signature for foo("a", "b") */ diff --git a/ets2panda/test/test-lists/astchecker/astchecker-ets-ignored.txt b/ets2panda/test/test-lists/astchecker/astchecker-ets-ignored.txt index 303bff6cd20d4f5577e84212a168342d08e65e23..3624dfed0688238788299a191394c32fe1676ec6 100644 --- a/ets2panda/test/test-lists/astchecker/astchecker-ets-ignored.txt +++ b/ets2panda/test/test-lists/astchecker/astchecker-ets-ignored.txt @@ -156,4 +156,6 @@ ast/parser/ets/multi_typeerror_function_implicit_return_value.ets ast/parser/ets/returntype_override_primitive.ets ast/parser/ets/switch_num_compare_char_duplicate.ets +ast/compiler/ets/errors/type/postcond_failed.ets + # No-primitives #24986 [end]