diff --git a/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/02.declarations/spec_decl1.ets b/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/02.declarations/spec_decl1.ets index bda724d1e414cb815a2afc9f4f1f2e5e8e130800..5d4853dcd051e0a35f970385eef2692cadd62dbd 100644 --- a/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/02.declarations/spec_decl1.ets +++ b/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/02.declarations/spec_decl1.ets @@ -24,10 +24,12 @@ function Pi(): double { return PI; } type IP = byte[] +enum Ip {one = 1, two, three} -function main(): int { +function main() { let x: IP = new byte[4] Pi() - if (Pi() == PI && pi == 3) return 0; - return 1; + arktest.assertEQ(Pi(), PI) + arktest.assertEQ(pi, 3) + arktest.assertEQ(Ip.three, 3) } diff --git a/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/02.declarations/spec_decl2.ets b/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/02.declarations/spec_decl2.ets index 7377642af61b8d6e8022ba406edaa3b4a9a85fc5..dacebac0c44e74226f0265bbd4c337d932a58bb1 100644 --- a/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/02.declarations/spec_decl2.ets +++ b/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/02.declarations/spec_decl2.ets @@ -25,7 +25,3 @@ class A {} type Person = A let Person: Person - -function main(): int { - return 0; -} diff --git a/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/02.declarations/spec_decl2_rt.ets b/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/02.declarations/spec_decl2_rt.ets index 12390f1c7dfdf3cf78976bd8e61e9197f3486091..efc2f14d2ebcc5565756f2c4d66d96d707b05e52 100644 --- a/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/02.declarations/spec_decl2_rt.ets +++ b/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/02.declarations/spec_decl2_rt.ets @@ -35,14 +35,9 @@ function foo(x: string): int { return 4; } -function main(): int { - if (foo() != 1) return 1; - - if (foo(1) != 2) return 1; - - if (foo(new int[0]) != 3) return 1; - - if (foo("") != 4) return 1; - - return 0; +function main() { + arktest.assertEQ(foo(), 1) + arktest.assertEQ(foo(1), 2) + arktest.assertEQ(foo(new int[0]), 3) + arktest.assertEQ(foo(""), 4) } diff --git a/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/02.declarations/spec_decl3.ets b/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/02.declarations/spec_decl3.ets new file mode 100644 index 0000000000000000000000000000000000000000..8d81b625289acc696c24a8ff32b3f7fb905d9cf6 --- /dev/null +++ b/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/02.declarations/spec_decl3.ets @@ -0,0 +1,30 @@ +/*--- +Copyright (c) 2024-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. +---*/ + +/*--- +desc: Declarations must be distinguishable in a declaration space. +tags: [negative, compile-only] +---*/ + +class A { + name: string = 'Alex' + age: string = '20' +} + +// The type and enum have the same name: + +type Person = A + +enum Person {name = 'Alex', age = '20'} diff --git a/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/02.declarations/spec_decl_n1.ets b/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/02.declarations/spec_decl_n1.ets index 62200994cd9130962906385b2ac5bf64dfdf21a8..c8cdc29e6285bac57eed3917c0126b76f0dbdd91 100644 --- a/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/02.declarations/spec_decl_n1.ets +++ b/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/02.declarations/spec_decl_n1.ets @@ -24,6 +24,3 @@ const PI = 3.14 function PI(): double { return 3.14 } -function main(): int { - return 0; -} diff --git a/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/02.declarations/spec_decl_n10.ets b/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/02.declarations/spec_decl_n10.ets index 2bb15b5f7399edbe1c8a970a5b065b8bca2ec0d8..863635daa9073664bf10f41f30f6abd87c1b5c2e 100644 --- a/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/02.declarations/spec_decl_n10.ets +++ b/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/02.declarations/spec_decl_n10.ets @@ -22,4 +22,3 @@ tags: [compile-only, negative] interface Object {} -function main() {} diff --git a/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/02.declarations/spec_decl_n11.ets b/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/02.declarations/spec_decl_n11.ets index 37f9366885db099b131610a04c0b4ec94dec2c8e..a6b7fcb47c3f97566e02e058eb322ffedae346b4 100644 --- a/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/02.declarations/spec_decl_n11.ets +++ b/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/02.declarations/spec_decl_n11.ets @@ -21,5 +21,3 @@ tags: [compile-only, negative] // CTE: Name of the declaration clashes with the predefined type or standard library entity name. let Array = 6666 - -function main() {} diff --git a/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/02.declarations/spec_decl_n12.ets b/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/02.declarations/spec_decl_n12.ets new file mode 100644 index 0000000000000000000000000000000000000000..c83c59da3e5085755cae5688208ae9aa9cb30efd --- /dev/null +++ b/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/02.declarations/spec_decl_n12.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. + */ + +/*--- +desc: Declarations must be distinguishable in a declaration space. +tags: [compile-only, negative] +---*/ + +// CTE: Class and enum have the same name. + +class Person { + name: string = 'Alex' + age: string = '20' +} + +enum Person (name = 'Alex', age = '20') + diff --git a/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/02.declarations/spec_decl_n2.ets b/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/02.declarations/spec_decl_n2.ets new file mode 100644 index 0000000000000000000000000000000000000000..c6317f513dbe1b6871c67d91287259c2e955b299 --- /dev/null +++ b/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/02.declarations/spec_decl_n2.ets @@ -0,0 +1,26 @@ +/*--- +Copyright (c) 2021-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. +---*/ + +/*--- +desc: Declarations must be distinguishable in a declaration space. +tags: [compile-only, negative] +---*/ + +// The constant and enum have the same name: + +const PI = 3.14 + +enum PI { One = 1, Two, Three } + diff --git a/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/02.declarations/spec_decl_n4.ets b/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/02.declarations/spec_decl_n4.ets index 62157ddf5285fb67a9d586f9a0643a729ce74cd9..4b5ae1619f9b092c9ff229b0e86ef219d22a9b40 100644 --- a/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/02.declarations/spec_decl_n4.ets +++ b/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/02.declarations/spec_decl_n4.ets @@ -23,7 +23,3 @@ tags: [compile-only, negative] function foo(x: int) {} function foo(y: int) {} - -function main(): int { - return 0; -} diff --git a/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/02.declarations/spec_decl_n5.ets b/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/02.declarations/spec_decl_n5.ets index def05a34d775efae24fd9a1e694724c0a6d2ff4c..4f8e1fea79e564c8aeddc42e88465e51a3d70a2c 100644 --- a/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/02.declarations/spec_decl_n5.ets +++ b/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/02.declarations/spec_decl_n5.ets @@ -25,7 +25,3 @@ function foo(x: int) {} type MyInt = int function foo(x: MyInt) {} - -function main(): int { - return 0; -} diff --git a/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/02.declarations/spec_decl_n6.ets b/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/02.declarations/spec_decl_n6.ets index baa962d7c76fb06ed46eb777ac07fa84c3119c88..a1076343eabf6ef2784d8776d00f3393b58e566c 100644 --- a/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/02.declarations/spec_decl_n6.ets +++ b/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/02.declarations/spec_decl_n6.ets @@ -24,4 +24,3 @@ class Person {} let Person: Person -function main() {} diff --git a/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/02.declarations/spec_decl_n7.ets b/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/02.declarations/spec_decl_n7.ets index 6a386359553674d44049775a901808b314fa1866..57e296234b1f18b4cb78ef3eb13924847d50eee5 100644 --- a/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/02.declarations/spec_decl_n7.ets +++ b/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/02.declarations/spec_decl_n7.ets @@ -22,4 +22,3 @@ tags: [compile-only, negative] let number: number = 1.0 -function main() {} diff --git a/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/02.declarations/spec_decl_n8.ets b/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/02.declarations/spec_decl_n8.ets index 8e173b11a21dd79019992ced7f7a4e19785f50be..274c5717cc5f0da91cada5b07ec688e5d7eeb278 100644 --- a/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/02.declarations/spec_decl_n8.ets +++ b/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/02.declarations/spec_decl_n8.ets @@ -20,6 +20,4 @@ tags: [compile-only, negative] // CTE: Name of the declaration clashes with the predefined type or standard library entity name. -let String = true - -function main() {} +let String = true \ No newline at end of file diff --git a/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/02.declarations/spec_decl_n9.ets b/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/02.declarations/spec_decl_n9.ets index cefbe406956553af8b467c42b915bbc74165feb1..5d6b65ae66881336d88d83eba672a71076ca7e07 100644 --- a/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/02.declarations/spec_decl_n9.ets +++ b/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/02.declarations/spec_decl_n9.ets @@ -22,4 +22,3 @@ tags: [compile-only, negative] function Record() {} -function main() {} diff --git a/static_core/plugins/ets/tests/ets-templates/06.contexts_and_conversions/04.numeric_operator_contexts/unary_numeric_promotion/unary_minus.params.yaml b/static_core/plugins/ets/tests/ets-templates/06.contexts_and_conversions/04.numeric_operator_contexts/unary_numeric_promotion/unary_minus.params.yaml index 5320611d931728af17c3f777013c159121cc3820..ee375fbf75e5c2109e76cf3e2055ddabb4f0c258 100644 --- a/static_core/plugins/ets/tests/ets-templates/06.contexts_and_conversions/04.numeric_operator_contexts/unary_numeric_promotion/unary_minus.params.yaml +++ b/static_core/plugins/ets/tests/ets-templates/06.contexts_and_conversions/04.numeric_operator_contexts/unary_numeric_promotion/unary_minus.params.yaml @@ -27,5 +27,5 @@ cases: - { type: Long, val: new Long(1), r: [6, 6, 6, -1, 1, -1] } - { type: Float, val: new Float(1.0f), r: [7.0f, 7.0f, 7.0f, -1.0f, 1.0f, -1.0f] } - { type: Double, val: new Double(1.00), r: [8, 8, 8, -1.0, 1.0, -1.0] } - - { type: IntEnum, val: IntEnum.Two, r: [5, 5, 5, 0, -1, 0] } + - { type: IntEnum, val: IntEnum.Two, r: [5, 5, 5, 1, -1, 1] } \ No newline at end of file diff --git a/static_core/plugins/ets/tests/ets-templates/06.contexts_and_conversions/04.numeric_operator_contexts/unary_numeric_promotion/unary_plus.params.yaml b/static_core/plugins/ets/tests/ets-templates/06.contexts_and_conversions/04.numeric_operator_contexts/unary_numeric_promotion/unary_plus.params.yaml index 5b2394c74b0865d479966ce46ab86b432356d7e9..eceb362eeb7dd9496fae1620489e4ae191c4a8b7 100644 --- a/static_core/plugins/ets/tests/ets-templates/06.contexts_and_conversions/04.numeric_operator_contexts/unary_numeric_promotion/unary_plus.params.yaml +++ b/static_core/plugins/ets/tests/ets-templates/06.contexts_and_conversions/04.numeric_operator_contexts/unary_numeric_promotion/unary_plus.params.yaml @@ -27,4 +27,4 @@ cases: - { type: Long, val: new Long(1), r: [6, 6, 6, 1, 1, 1] } - { type: Float, val: new Float(1.0f), r: [7.0f, 7.0f, 7.0f, 1.0f, 1.0f, 1.0f] } - { type: Double, val: new Double(1.00), r: [8, 8, 8, 1.0, 1.0, 1.0] } - - { type: IntEnum, val: IntEnum.Two, r: [5, 5, 5, 0, -1, 0] } + - { type: IntEnum, val: IntEnum.Two, r: [5, 5, 5, -1, -1, -1] } diff --git a/static_core/plugins/ets/tests/test-lists/declgenets2ts/ets-cts/declgen-ets2ts-cts-ignored.txt b/static_core/plugins/ets/tests/test-lists/declgenets2ts/ets-cts/declgen-ets2ts-cts-ignored.txt index 53515680859ed8545e0718726a1cebde9a250c40..c1c5101fa29d3ea1e8dde3a4a5e77468537f9e97 100644 --- a/static_core/plugins/ets/tests/test-lists/declgenets2ts/ets-cts/declgen-ets2ts-cts-ignored.txt +++ b/static_core/plugins/ets/tests/test-lists/declgenets2ts/ets-cts/declgen-ets2ts-cts-ignored.txt @@ -2038,3 +2038,21 @@ 09.classes/03.class_implementation_clause/02.implementing_required_interface_properties/override_field_with_static.ets 09.classes/10.inheritance/inheritance_static_methods_from_superinterface.ets 10.interfaces/03.interface_members/static_methods_inheritance.ets +04.names_declarations_and_scopes/02.declarations/spec_decl2.ets +04.names_declarations_and_scopes/02.declarations/spec_decl_n3.ets +04.names_declarations_and_scopes/02.declarations/spec_decl2_co.ets +04.names_declarations_and_scopes/02.declarations/spec_decl_n9.ets +04.names_declarations_and_scopes/02.declarations/spec_decl_n1.ets +04.names_declarations_and_scopes/02.declarations/spec_decl_n4.ets +04.names_declarations_and_scopes/02.declarations/spec_decl_n12.ets +04.names_declarations_and_scopes/02.declarations/spec_decl3.ets +04.names_declarations_and_scopes/02.declarations/spec_decl_n10.ets +04.names_declarations_and_scopes/02.declarations/spec_decl_n6.ets +04.names_declarations_and_scopes/02.declarations/spec_decl_n2.ets +04.names_declarations_and_scopes/02.declarations/spec_decl_n11.ets +04.names_declarations_and_scopes/02.declarations/spec_decl_n8.ets +04.names_declarations_and_scopes/02.declarations/spec_decl_n5.ets +04.names_declarations_and_scopes/02.declarations/spec_decl2_rt.ets +04.names_declarations_and_scopes/02.declarations/spec_decl1.ets +04.names_declarations_and_scopes/02.declarations/spec_decl_n7.ets + diff --git a/static_core/plugins/ets/tests/test-lists/ets-cts/ets-cts-ignored.txt b/static_core/plugins/ets/tests/test-lists/ets-cts/ets-cts-ignored.txt index 84c2587464a0075552bf0a36de8c5f34529768ca..ffddba123b031df921b64ad014a6ca6739873b05 100644 --- a/static_core/plugins/ets/tests/test-lists/ets-cts/ets-cts-ignored.txt +++ b/static_core/plugins/ets/tests/test-lists/ets-cts/ets-cts-ignored.txt @@ -911,9 +911,7 @@ #27058 06.contexts_and_conversions/01.type_of_expression/standalone_expression_n_1.ets -#27123 -06.contexts_and_conversions/04.numeric_operator_contexts/unary_numeric_promotion/unary_minus_14.ets -06.contexts_and_conversions/04.numeric_operator_contexts/unary_numeric_promotion/unary_plus_14.ets +#29887 06.contexts_and_conversions/04.numeric_operator_contexts/binary_numeric_promotion/result_type_cond_72.ets 06.contexts_and_conversions/04.numeric_operator_contexts/binary_numeric_promotion/result_type_cond_73.ets 06.contexts_and_conversions/04.numeric_operator_contexts/binary_numeric_promotion/result_type_cond_74.ets