From 54d8edd72bb39a8790b71af19a0c312e13c50c7d Mon Sep 17 00:00:00 2001 From: michaelfrost Date: Fri, 12 Sep 2025 11:34:49 +0300 Subject: [PATCH] Tests updated for 8.4 Description: Tests for 8.4 Local Declarations were updated. Issue: https://gitee.com/openharmony/arkcompiler_runtime_core/issues/ICXR62 Test: All pre-merge tests passed. Results are available in the ggwatcher. Signed-off-by: michaelfrost Change-Id: I496728c85d0b941afb4cf9d8eb2e62e75de27dfd --- .../local_declaration_access_n.ets | 36 +++++++++++++++++++ .../local_declaration_access_n.params.yaml | 19 ++++++++++ .../post_declaration_func_n.ets | 31 ++++++++++++++++ .../post_declaration_func_n.params.yaml | 17 +++++++++ .../post_declaration_n.ets | 26 ++++++++++++++ .../post_declaration_n.params.yaml | 17 +++++++++ .../test-lists/ets-cts/ets-cts-ignored.txt | 4 +++ 7 files changed, 150 insertions(+) create mode 100644 static_core/plugins/ets/tests/ets-templates/08.statements/04.local_declarations/local_declaration_access_n.ets create mode 100644 static_core/plugins/ets/tests/ets-templates/08.statements/04.local_declarations/local_declaration_access_n.params.yaml create mode 100644 static_core/plugins/ets/tests/ets-templates/08.statements/04.local_declarations/post_declaration_func_n.ets create mode 100644 static_core/plugins/ets/tests/ets-templates/08.statements/04.local_declarations/post_declaration_func_n.params.yaml create mode 100644 static_core/plugins/ets/tests/ets-templates/08.statements/04.local_declarations/post_declaration_n.ets create mode 100644 static_core/plugins/ets/tests/ets-templates/08.statements/04.local_declarations/post_declaration_n.params.yaml diff --git a/static_core/plugins/ets/tests/ets-templates/08.statements/04.local_declarations/local_declaration_access_n.ets b/static_core/plugins/ets/tests/ets-templates/08.statements/04.local_declarations/local_declaration_access_n.ets new file mode 100644 index 0000000000..bd9213cfb8 --- /dev/null +++ b/static_core/plugins/ets/tests/ets-templates/08.statements/04.local_declarations/local_declaration_access_n.ets @@ -0,0 +1,36 @@ +/*--- +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. +---*/ + +{% for c in cases %} +/*--- +desc: Local declaration - use a name declared in another block. +tags: [compile-only, negative] +---*/ + +function add5(b: int): int { + {{c.decl}} a: int = 5; + let i: int = a + b; + return i; +} + +function main(): void { + let j: int = 0; + { + {{c.decl}} k = 7; + j = add5(k); + } + let y = {{c.name}}; +} +{% endfor %} diff --git a/static_core/plugins/ets/tests/ets-templates/08.statements/04.local_declarations/local_declaration_access_n.params.yaml b/static_core/plugins/ets/tests/ets-templates/08.statements/04.local_declarations/local_declaration_access_n.params.yaml new file mode 100644 index 0000000000..a60cdb6600 --- /dev/null +++ b/static_core/plugins/ets/tests/ets-templates/08.statements/04.local_declarations/local_declaration_access_n.params.yaml @@ -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. + +--- +cases: + - { decl: 'let', name: a } + - { decl: 'const', name: a } + - { decl: 'let', name: k } + - { decl: 'const', name: k } diff --git a/static_core/plugins/ets/tests/ets-templates/08.statements/04.local_declarations/post_declaration_func_n.ets b/static_core/plugins/ets/tests/ets-templates/08.statements/04.local_declarations/post_declaration_func_n.ets new file mode 100644 index 0000000000..732a71e0db --- /dev/null +++ b/static_core/plugins/ets/tests/ets-templates/08.statements/04.local_declarations/post_declaration_func_n.ets @@ -0,0 +1,31 @@ +/*--- +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. +---*/ + +{% for c in cases %} +/*--- +desc: Local declaration - use a name before declaration. +tags: [compile-only, negative] +---*/ + +function add5(b: int): int { + let i: int = a + b; + {{c.decl}} a: int = 5; + return i; +} + +function main(): void { + let y: int = add5(7); +} +{% endfor %} diff --git a/static_core/plugins/ets/tests/ets-templates/08.statements/04.local_declarations/post_declaration_func_n.params.yaml b/static_core/plugins/ets/tests/ets-templates/08.statements/04.local_declarations/post_declaration_func_n.params.yaml new file mode 100644 index 0000000000..bcb32ca550 --- /dev/null +++ b/static_core/plugins/ets/tests/ets-templates/08.statements/04.local_declarations/post_declaration_func_n.params.yaml @@ -0,0 +1,17 @@ +# 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. + +--- +cases: + - decl: 'let' + - decl: 'const' diff --git a/static_core/plugins/ets/tests/ets-templates/08.statements/04.local_declarations/post_declaration_n.ets b/static_core/plugins/ets/tests/ets-templates/08.statements/04.local_declarations/post_declaration_n.ets new file mode 100644 index 0000000000..a159657db9 --- /dev/null +++ b/static_core/plugins/ets/tests/ets-templates/08.statements/04.local_declarations/post_declaration_n.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. +---*/ + +{% for c in cases %} +/*--- +desc: Local declaration - use name before declaration. +tags: [compile-only, negative] +---*/ + +function main(): void { + let b: int = a + 7; + {{c.decl}} a: int = 5; +} +{% endfor %} diff --git a/static_core/plugins/ets/tests/ets-templates/08.statements/04.local_declarations/post_declaration_n.params.yaml b/static_core/plugins/ets/tests/ets-templates/08.statements/04.local_declarations/post_declaration_n.params.yaml new file mode 100644 index 0000000000..bcb32ca550 --- /dev/null +++ b/static_core/plugins/ets/tests/ets-templates/08.statements/04.local_declarations/post_declaration_n.params.yaml @@ -0,0 +1,17 @@ +# 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. + +--- +cases: + - decl: 'let' + - decl: 'const' 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 1784c36450..4fa8e64d58 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 @@ -1246,6 +1246,10 @@ #23051 Reference comparison 07.expressions/25.equality_expressions/reference_equality/type_conversion_of_one_operand_to_another_type.ets +#29971 +08.statements/04.local_declarations/post_declaration_func_n_1.ets +08.statements/04.local_declarations/post_declaration_n_1.ets + #25042 Ast verifier failure for for-of with labelled statement 08.statements/11.continue_statements/continue_for_of3l.ets 08.statements/11.continue_statements/continue_for_of5l.ets -- Gitee