From ebb4f04a8a6d4b1428b881d23e0209b3fd0add94 Mon Sep 17 00:00:00 2001 From: wangzhengji Date: Mon, 1 Sep 2025 21:15:55 +0800 Subject: [PATCH] Fix missing CTE type widen Issue: https://gitee.com/openharmony/arkcompiler_ets_frontend/issues/ICVAZ0 Signed-off-by: wangzhengji --- .../postfix_decrement_byte.ets | 3 ++ .../postfix_decrement_short.ets | 3 ++ .../postfix_increment_byte.ets | 3 ++ .../postfix_increment_short.ets | 3 ++ .../prefix_decrement_byte.ets | 3 ++ .../prefix_decrement_short.ets | 3 ++ .../prefix_increment_byte.ets | 3 ++ .../prefix_increment_short.ets | 3 ++ .../postfix_conversion.params.yaml | 4 --- .../postfix_conversion_byte.ets | 29 +++++++++++++++++++ .../postfix_conversion_byte.params.yaml | 18 ++++++++++++ .../postfix_conversion_short.ets | 29 +++++++++++++++++++ .../postfix_conversion_short.params.yaml | 18 ++++++++++++ .../prefix_conversion.params.yaml | 4 --- .../prefix_conversion_byte.ets | 29 +++++++++++++++++++ .../prefix_conversion_byte.params.yaml | 19 ++++++++++++ .../prefix_conversion_short.ets | 29 +++++++++++++++++++ .../prefix_conversion_short.params.yaml | 19 ++++++++++++ .../ind.params.yaml | 7 +++-- 19 files changed, 218 insertions(+), 11 deletions(-) create mode 100644 static_core/plugins/ets/tests/ets-templates/06.contexts_and_conversions/06.numeric_casting_conversions/postfix_conversion_byte.ets create mode 100644 static_core/plugins/ets/tests/ets-templates/06.contexts_and_conversions/06.numeric_casting_conversions/postfix_conversion_byte.params.yaml create mode 100644 static_core/plugins/ets/tests/ets-templates/06.contexts_and_conversions/06.numeric_casting_conversions/postfix_conversion_short.ets create mode 100644 static_core/plugins/ets/tests/ets-templates/06.contexts_and_conversions/06.numeric_casting_conversions/postfix_conversion_short.params.yaml create mode 100644 static_core/plugins/ets/tests/ets-templates/06.contexts_and_conversions/06.numeric_casting_conversions/prefix_conversion_byte.ets create mode 100644 static_core/plugins/ets/tests/ets-templates/06.contexts_and_conversions/06.numeric_casting_conversions/prefix_conversion_byte.params.yaml create mode 100644 static_core/plugins/ets/tests/ets-templates/06.contexts_and_conversions/06.numeric_casting_conversions/prefix_conversion_short.ets create mode 100644 static_core/plugins/ets/tests/ets-templates/06.contexts_and_conversions/06.numeric_casting_conversions/prefix_conversion_short.params.yaml diff --git a/static_core/plugins/ets/tests/ets-templates/03.types/06.value_types/02.integer_types_and_operations/postfix_decrement/postfix_decrement_byte.ets b/static_core/plugins/ets/tests/ets-templates/03.types/06.value_types/02.integer_types_and_operations/postfix_decrement/postfix_decrement_byte.ets index c9f4b0827d..7b8efe887d 100644 --- a/static_core/plugins/ets/tests/ets-templates/03.types/06.value_types/02.integer_types_and_operations/postfix_decrement/postfix_decrement_byte.ets +++ b/static_core/plugins/ets/tests/ets-templates/03.types/06.value_types/02.integer_types_and_operations/postfix_decrement/postfix_decrement_byte.ets @@ -16,6 +16,7 @@ limitations under the License. {% for v in values %} /*--- desc: check postfix decrement for byte operand +tags: [negative, compile-only] ---*/ function main(): void { @@ -26,3 +27,5 @@ function main(): void { } {% endfor %} + +/* @@? 23:18 Error TypeError: Type 'Int' cannot be assigned to type 'Byte' */ diff --git a/static_core/plugins/ets/tests/ets-templates/03.types/06.value_types/02.integer_types_and_operations/postfix_decrement/postfix_decrement_short.ets b/static_core/plugins/ets/tests/ets-templates/03.types/06.value_types/02.integer_types_and_operations/postfix_decrement/postfix_decrement_short.ets index 0401906dfc..e35969119d 100644 --- a/static_core/plugins/ets/tests/ets-templates/03.types/06.value_types/02.integer_types_and_operations/postfix_decrement/postfix_decrement_short.ets +++ b/static_core/plugins/ets/tests/ets-templates/03.types/06.value_types/02.integer_types_and_operations/postfix_decrement/postfix_decrement_short.ets @@ -16,6 +16,7 @@ limitations under the License. {% for v in values %} /*--- desc: check postfix decrement for short integer operand +tags: [negative, compile-only] ---*/ function main(): void { @@ -26,3 +27,5 @@ function main(): void { } {% endfor %} + +/* @@? 23:19 Error TypeError: Type 'Int' cannot be assigned to type 'Short' */ diff --git a/static_core/plugins/ets/tests/ets-templates/03.types/06.value_types/02.integer_types_and_operations/postfix_increment/postfix_increment_byte.ets b/static_core/plugins/ets/tests/ets-templates/03.types/06.value_types/02.integer_types_and_operations/postfix_increment/postfix_increment_byte.ets index 96a83de327..8d13f5c6e4 100644 --- a/static_core/plugins/ets/tests/ets-templates/03.types/06.value_types/02.integer_types_and_operations/postfix_increment/postfix_increment_byte.ets +++ b/static_core/plugins/ets/tests/ets-templates/03.types/06.value_types/02.integer_types_and_operations/postfix_increment/postfix_increment_byte.ets @@ -16,6 +16,7 @@ limitations under the License. {% for v in values %} /*--- desc: check postfix increment for byte operand +tags: [negative, compile-only] ---*/ function main(): void { @@ -26,3 +27,5 @@ function main(): void { } {% endfor %} + +/* @@? 23:18 Error TypeError: Type 'Int' cannot be assigned to type 'Byte' */ diff --git a/static_core/plugins/ets/tests/ets-templates/03.types/06.value_types/02.integer_types_and_operations/postfix_increment/postfix_increment_short.ets b/static_core/plugins/ets/tests/ets-templates/03.types/06.value_types/02.integer_types_and_operations/postfix_increment/postfix_increment_short.ets index 3e0169256e..0f96d9d9e2 100644 --- a/static_core/plugins/ets/tests/ets-templates/03.types/06.value_types/02.integer_types_and_operations/postfix_increment/postfix_increment_short.ets +++ b/static_core/plugins/ets/tests/ets-templates/03.types/06.value_types/02.integer_types_and_operations/postfix_increment/postfix_increment_short.ets @@ -16,6 +16,7 @@ limitations under the License. {% for v in values %} /*--- desc: check postfix increment for short integer operand +tags: [negative, compile-only] ---*/ function main(): void { @@ -26,3 +27,5 @@ function main(): void { } {% endfor %} + +/* @@? 23:19 Error TypeError: Type 'Int' cannot be assigned to type 'Short' */ diff --git a/static_core/plugins/ets/tests/ets-templates/03.types/06.value_types/02.integer_types_and_operations/prefix_decrement/prefix_decrement_byte.ets b/static_core/plugins/ets/tests/ets-templates/03.types/06.value_types/02.integer_types_and_operations/prefix_decrement/prefix_decrement_byte.ets index a7cec74952..a7dc005b57 100644 --- a/static_core/plugins/ets/tests/ets-templates/03.types/06.value_types/02.integer_types_and_operations/prefix_decrement/prefix_decrement_byte.ets +++ b/static_core/plugins/ets/tests/ets-templates/03.types/06.value_types/02.integer_types_and_operations/prefix_decrement/prefix_decrement_byte.ets @@ -16,6 +16,7 @@ limitations under the License. {% for v in values %} /*--- desc: check prefix decrement for byte operand +tags: [negative, compile-only] ---*/ function main(): void { @@ -26,3 +27,5 @@ function main(): void { } {% endfor %} + +/* @@? 23:22 Error TypeError: Type 'Int' cannot be assigned to type 'Byte' */ diff --git a/static_core/plugins/ets/tests/ets-templates/03.types/06.value_types/02.integer_types_and_operations/prefix_decrement/prefix_decrement_short.ets b/static_core/plugins/ets/tests/ets-templates/03.types/06.value_types/02.integer_types_and_operations/prefix_decrement/prefix_decrement_short.ets index 20aa514c22..d3377a5ad4 100644 --- a/static_core/plugins/ets/tests/ets-templates/03.types/06.value_types/02.integer_types_and_operations/prefix_decrement/prefix_decrement_short.ets +++ b/static_core/plugins/ets/tests/ets-templates/03.types/06.value_types/02.integer_types_and_operations/prefix_decrement/prefix_decrement_short.ets @@ -16,6 +16,7 @@ limitations under the License. {% for v in values %} /*--- desc: check prefix decrement for short integer operand +tags: [negative, compile-only] ---*/ function main(): void { @@ -26,3 +27,5 @@ function main(): void { } {% endfor %} + +/* @@? 23:23 Error TypeError: Type 'Int' cannot be assigned to type 'Short' */ diff --git a/static_core/plugins/ets/tests/ets-templates/03.types/06.value_types/02.integer_types_and_operations/prefix_increment/prefix_increment_byte.ets b/static_core/plugins/ets/tests/ets-templates/03.types/06.value_types/02.integer_types_and_operations/prefix_increment/prefix_increment_byte.ets index b79d2724ee..f831742eb1 100644 --- a/static_core/plugins/ets/tests/ets-templates/03.types/06.value_types/02.integer_types_and_operations/prefix_increment/prefix_increment_byte.ets +++ b/static_core/plugins/ets/tests/ets-templates/03.types/06.value_types/02.integer_types_and_operations/prefix_increment/prefix_increment_byte.ets @@ -16,6 +16,7 @@ limitations under the License. {% for v in values %} /*--- desc: check prefix increment for byte operand +tags: [negative, compile-only] ---*/ function main(): void { @@ -26,3 +27,5 @@ function main(): void { } {% endfor %} + +/* @@? 23:22 Error TypeError: Type 'Int' cannot be assigned to type 'Byte' */ diff --git a/static_core/plugins/ets/tests/ets-templates/03.types/06.value_types/02.integer_types_and_operations/prefix_increment/prefix_increment_short.ets b/static_core/plugins/ets/tests/ets-templates/03.types/06.value_types/02.integer_types_and_operations/prefix_increment/prefix_increment_short.ets index 7bbd19dc98..9aa26aa5e2 100644 --- a/static_core/plugins/ets/tests/ets-templates/03.types/06.value_types/02.integer_types_and_operations/prefix_increment/prefix_increment_short.ets +++ b/static_core/plugins/ets/tests/ets-templates/03.types/06.value_types/02.integer_types_and_operations/prefix_increment/prefix_increment_short.ets @@ -16,6 +16,7 @@ limitations under the License. {% for v in values %} /*--- desc: check prefix increment for short integer operand +tags: [negative, compile-only] ---*/ function main(): void { @@ -26,3 +27,5 @@ function main(): void { } {% endfor %} + +/* @@? 23:23 Error TypeError: Type 'Int' cannot be assigned to type 'Short' */ diff --git a/static_core/plugins/ets/tests/ets-templates/06.contexts_and_conversions/06.numeric_casting_conversions/postfix_conversion.params.yaml b/static_core/plugins/ets/tests/ets-templates/06.contexts_and_conversions/06.numeric_casting_conversions/postfix_conversion.params.yaml index c9bf128c99..d746c56d55 100644 --- a/static_core/plugins/ets/tests/ets-templates/06.contexts_and_conversions/06.numeric_casting_conversions/postfix_conversion.params.yaml +++ b/static_core/plugins/ets/tests/ets-templates/06.contexts_and_conversions/06.numeric_casting_conversions/postfix_conversion.params.yaml @@ -13,15 +13,11 @@ --- types: - - { ptype: byte, expr: 0x55, postfix: ++, result: 86 } - - { ptype: short, expr: 0x5555, postfix: ++, result: 21846 } - { ptype: int, expr: 0x12121212, postfix: ++, result: 303174163 } - { ptype: long, expr: 0x3434343456565656, postfix: ++, result: 3761688988152649303 } - { ptype: float, expr: 0.00001f, postfix: ++, result: 1.00001f } - { ptype: double, expr: 0.00000000001, postfix: ++, result: 1.00000000001 } - - { ptype: byte, expr: 0x55, postfix: --, result: 84 } - - { ptype: short, expr: 0x5555, postfix: --, result: 21844 } - { ptype: int, expr: 0x12121212, postfix: --, result: 303174161 } - { ptype: long, expr: 0x3434343456565656, postfix: --, result: 3761688988152649301 } - { ptype: float, expr: 0.00001f, postfix: --, result: -0.99999f} diff --git a/static_core/plugins/ets/tests/ets-templates/06.contexts_and_conversions/06.numeric_casting_conversions/postfix_conversion_byte.ets b/static_core/plugins/ets/tests/ets-templates/06.contexts_and_conversions/06.numeric_casting_conversions/postfix_conversion_byte.ets new file mode 100644 index 0000000000..82fc479d2d --- /dev/null +++ b/static_core/plugins/ets/tests/ets-templates/06.contexts_and_conversions/06.numeric_casting_conversions/postfix_conversion_byte.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. + */ + +{% for t in types %} +/*--- +desc: Casting conversion implicitly in the following arithmetic operations - Postfix Increment +tags: [negative, compile-only] +---*/ + +function main(): void { + let p{{loop.index}}: {{t.ptype}} = {{t.expr|safe}}; + let r{{loop.index}}: {{t.ptype}} = p{{loop.index}}{{t.postfix}}; + arktest.assertEQ(p{{loop.index}}, {{t.result}}) +} +{% endfor %} + +/* @@? 23:18 Error TypeError: Type 'Int' cannot be assigned to type 'Byte' */ diff --git a/static_core/plugins/ets/tests/ets-templates/06.contexts_and_conversions/06.numeric_casting_conversions/postfix_conversion_byte.params.yaml b/static_core/plugins/ets/tests/ets-templates/06.contexts_and_conversions/06.numeric_casting_conversions/postfix_conversion_byte.params.yaml new file mode 100644 index 0000000000..14f1b767bc --- /dev/null +++ b/static_core/plugins/ets/tests/ets-templates/06.contexts_and_conversions/06.numeric_casting_conversions/postfix_conversion_byte.params.yaml @@ -0,0 +1,18 @@ +# 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. + +--- +types: + - { ptype: byte, expr: 0x55, postfix: ++, result: 86 } + + - { ptype: byte, expr: 0x55, postfix: --, result: 84 } diff --git a/static_core/plugins/ets/tests/ets-templates/06.contexts_and_conversions/06.numeric_casting_conversions/postfix_conversion_short.ets b/static_core/plugins/ets/tests/ets-templates/06.contexts_and_conversions/06.numeric_casting_conversions/postfix_conversion_short.ets new file mode 100644 index 0000000000..49b6673628 --- /dev/null +++ b/static_core/plugins/ets/tests/ets-templates/06.contexts_and_conversions/06.numeric_casting_conversions/postfix_conversion_short.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. + */ + +{% for t in types %} +/*--- +desc: Casting conversion implicitly in the following arithmetic operations - Postfix Increment +tags: [negative, compile-only] +---*/ + +function main(): void { + let p{{loop.index}}: {{t.ptype}} = {{t.expr|safe}}; + let r{{loop.index}}: {{t.ptype}} = p{{loop.index}}{{t.postfix}}; + arktest.assertEQ(p{{loop.index}}, {{t.result}}) +} +{% endfor %} + +/* @@? 23:19 Error TypeError: Type 'Int' cannot be assigned to type 'Short' */ diff --git a/static_core/plugins/ets/tests/ets-templates/06.contexts_and_conversions/06.numeric_casting_conversions/postfix_conversion_short.params.yaml b/static_core/plugins/ets/tests/ets-templates/06.contexts_and_conversions/06.numeric_casting_conversions/postfix_conversion_short.params.yaml new file mode 100644 index 0000000000..688f72fc49 --- /dev/null +++ b/static_core/plugins/ets/tests/ets-templates/06.contexts_and_conversions/06.numeric_casting_conversions/postfix_conversion_short.params.yaml @@ -0,0 +1,18 @@ +# 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. + +--- +types: + - { ptype: short, expr: 0x5555, postfix: ++, result: 21846 } + + - { ptype: short, expr: 0x5555, postfix: --, result: 21844 } diff --git a/static_core/plugins/ets/tests/ets-templates/06.contexts_and_conversions/06.numeric_casting_conversions/prefix_conversion.params.yaml b/static_core/plugins/ets/tests/ets-templates/06.contexts_and_conversions/06.numeric_casting_conversions/prefix_conversion.params.yaml index 0ba99f409b..4c1ed8b6c6 100644 --- a/static_core/plugins/ets/tests/ets-templates/06.contexts_and_conversions/06.numeric_casting_conversions/prefix_conversion.params.yaml +++ b/static_core/plugins/ets/tests/ets-templates/06.contexts_and_conversions/06.numeric_casting_conversions/prefix_conversion.params.yaml @@ -14,15 +14,11 @@ --- types: - - { ptype: byte, expr: 0x55, prefix: ++, result: 86 } - - { ptype: short, expr: 0x5555, prefix: ++, result: 21846 } - { ptype: int, expr: 0x12121212, prefix: ++, result: 303174163 } - { ptype: long, expr: 0x3434343456565656, prefix: ++, result: 3761688988152649303 } - { ptype: float, expr: 0.00001f, prefix: ++, result: 1.00001f } - { ptype: double, expr: 0.00000000001, prefix: ++, result: 1.00000000001 } - - { ptype: byte, expr: 0x55, prefix: --, result: 84 } - - { ptype: short, expr: 0x5555, prefix: --, result: 21844 } - { ptype: int, expr: 0x12121212, prefix: --, result: 303174161 } - { ptype: long, expr: 0x3434343456565656, prefix: --, result: 3761688988152649301 } - { ptype: float, expr: 0.00001f, prefix: --, result: -0.99999f } diff --git a/static_core/plugins/ets/tests/ets-templates/06.contexts_and_conversions/06.numeric_casting_conversions/prefix_conversion_byte.ets b/static_core/plugins/ets/tests/ets-templates/06.contexts_and_conversions/06.numeric_casting_conversions/prefix_conversion_byte.ets new file mode 100644 index 0000000000..1fdd8f3a56 --- /dev/null +++ b/static_core/plugins/ets/tests/ets-templates/06.contexts_and_conversions/06.numeric_casting_conversions/prefix_conversion_byte.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. + */ + +{% for t in types %} +/*--- +desc: Casting conversion implicitly in the following arithmetic operations - Prefix Increment +tags: [negative, compile-only] +---*/ + +function main(): void { + let p{{loop.index}}: {{t.ptype}} = {{t.expr|safe}}; + let r{{loop.index}}: {{t.ptype}} = {{t.prefix}}p{{loop.index}}; + arktest.assertEQ(r{{loop.index}}, {{t.result}}) +} +{% endfor %} + +/* @@? 23:22 Error TypeError: Type 'Int' cannot be assigned to type 'Byte' */ diff --git a/static_core/plugins/ets/tests/ets-templates/06.contexts_and_conversions/06.numeric_casting_conversions/prefix_conversion_byte.params.yaml b/static_core/plugins/ets/tests/ets-templates/06.contexts_and_conversions/06.numeric_casting_conversions/prefix_conversion_byte.params.yaml new file mode 100644 index 0000000000..206eb2ac65 --- /dev/null +++ b/static_core/plugins/ets/tests/ets-templates/06.contexts_and_conversions/06.numeric_casting_conversions/prefix_conversion_byte.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. + +--- + +types: + - { ptype: byte, expr: 0x55, prefix: ++, result: 86 } + + - { ptype: byte, expr: 0x55, prefix: --, result: 84 } diff --git a/static_core/plugins/ets/tests/ets-templates/06.contexts_and_conversions/06.numeric_casting_conversions/prefix_conversion_short.ets b/static_core/plugins/ets/tests/ets-templates/06.contexts_and_conversions/06.numeric_casting_conversions/prefix_conversion_short.ets new file mode 100644 index 0000000000..796e425117 --- /dev/null +++ b/static_core/plugins/ets/tests/ets-templates/06.contexts_and_conversions/06.numeric_casting_conversions/prefix_conversion_short.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. + */ + +{% for t in types %} +/*--- +desc: Casting conversion implicitly in the following arithmetic operations - Prefix Increment +tags: [negative, compile-only] +---*/ + +function main(): void { + let p{{loop.index}}: {{t.ptype}} = {{t.expr|safe}}; + let r{{loop.index}}: {{t.ptype}} = {{t.prefix}}p{{loop.index}}; + arktest.assertEQ(r{{loop.index}}, {{t.result}}) +} +{% endfor %} + +/* @@? 23:23 Error TypeError: Type 'Int' cannot be assigned to type 'Short' */ diff --git a/static_core/plugins/ets/tests/ets-templates/06.contexts_and_conversions/06.numeric_casting_conversions/prefix_conversion_short.params.yaml b/static_core/plugins/ets/tests/ets-templates/06.contexts_and_conversions/06.numeric_casting_conversions/prefix_conversion_short.params.yaml new file mode 100644 index 0000000000..2c8c217986 --- /dev/null +++ b/static_core/plugins/ets/tests/ets-templates/06.contexts_and_conversions/06.numeric_casting_conversions/prefix_conversion_short.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. + +--- + +types: + - { ptype: short, expr: 0x5555, prefix: ++, result: 21846 } + + - { ptype: short, expr: 0x5555, prefix: --, result: 21844 } diff --git a/static_core/plugins/ets/tests/ets-templates/07.expressions/12.indexing_expression/03.record_indexing_expression/ind.params.yaml b/static_core/plugins/ets/tests/ets-templates/07.expressions/12.indexing_expression/03.record_indexing_expression/ind.params.yaml index f02abe58e6..b8695b2d28 100644 --- a/static_core/plugins/ets/tests/ets-templates/07.expressions/12.indexing_expression/03.record_indexing_expression/ind.params.yaml +++ b/static_core/plugins/ets/tests/ets-templates/07.expressions/12.indexing_expression/03.record_indexing_expression/ind.params.yaml @@ -14,13 +14,14 @@ --- cases: # Record key is a union of string literal types - - use: |- + - tags: 'compile-only, negative' + use: |- // key is a union of literal types let idx: short = 0 let r: Record<"1"|"2"|"3", Short> = { "1": (idx += 1), - "2": idx++, - "3": ++idx, + "2": idx++, // CTE expected, update expression will extend 'idx' to the 'Int' type + "3": ++idx, // CTE expected, update expression will extend 'idx' to the 'Int' type } arktest.assertTrue(idx == 3) arktest.assertTrue(r["1"] == 1 && r["2"] == 1 && r["3"] == 3) -- Gitee