From 0f0696fda5270711381890860cfb134997964a4c Mon Sep 17 00:00:00 2001 From: Robert Sipka Date: Fri, 12 Sep 2025 14:16:20 +0200 Subject: [PATCH] Modify some tests to avoid invalid conversions Issue: ICXM15 Internal issue: 29895 Note: To achieve full support, char must be removed from ETS_CONVERTIBLE_TO_NUMERIC flags, but this leads to addressing a broader issue. Change-Id: I32cf6fe9b292a8c5977435402d3841d938e04e4e Signed-off-by: Robert Sipka --- .../02.assignment-like_contexts/widening_prim.params.yaml | 8 ++++---- .../widening_prim_call.params.yaml | 8 ++++---- .../method_return_value/method_return_value_20.ets | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/static_core/plugins/ets/tests/ets-templates/06.contexts_and_conversions/02.assignment-like_contexts/widening_prim.params.yaml b/static_core/plugins/ets/tests/ets-templates/06.contexts_and_conversions/02.assignment-like_contexts/widening_prim.params.yaml index 92bcd9723b..9af2709ce6 100644 --- a/static_core/plugins/ets/tests/ets-templates/06.contexts_and_conversions/02.assignment-like_contexts/widening_prim.params.yaml +++ b/static_core/plugins/ets/tests/ets-templates/06.contexts_and_conversions/02.assignment-like_contexts/widening_prim.params.yaml @@ -29,13 +29,13 @@ cases: - { src_type: byte, src_val: 127, dst_type: double, dst_val: 127.0 } - { src_type: byte, src_val: -128, dst_type: double, dst_val: -128.0 } - - { src_type: char, src_val: 0, dst_type: int, dst_val: 0 } + - { src_type: char, src_val: Int.toChar(0), dst_type: int, dst_val: 0 } - { src_type: char, src_val: "c'\\uFFFF'", dst_type: int, dst_val: 0x0000FFFF } - - { src_type: char, src_val: 0, dst_type: long, dst_val: 0 } + - { src_type: char, src_val: Int.toChar(0), dst_type: long, dst_val: 0 } - { src_type: char, src_val: "c'\\uFFFF'", dst_type: long, dst_val: 0x000000000000FFFF } - - { src_type: char, src_val: 0, dst_type: float, dst_val: 0.0 } + - { src_type: char, src_val: Int.toChar(0), dst_type: float, dst_val: 0.0 } - { src_type: char, src_val: "c'\\uFFFF'", dst_type: float, dst_val: 65535.0 } - - { src_type: char, src_val: 0, dst_type: double, dst_val: 0.0 } + - { src_type: char, src_val: Int.toChar(0), dst_type: double, dst_val: 0.0 } - { src_type: char, src_val: "c'\\uFFFF'", dst_type: double, dst_val: 65535.0 } - { src_type: short, src_val: 0, dst_type: int, dst_val: 0 } diff --git a/static_core/plugins/ets/tests/ets-templates/06.contexts_and_conversions/02.assignment-like_contexts/widening_prim_call.params.yaml b/static_core/plugins/ets/tests/ets-templates/06.contexts_and_conversions/02.assignment-like_contexts/widening_prim_call.params.yaml index 5edbe4c56a..217161867b 100644 --- a/static_core/plugins/ets/tests/ets-templates/06.contexts_and_conversions/02.assignment-like_contexts/widening_prim_call.params.yaml +++ b/static_core/plugins/ets/tests/ets-templates/06.contexts_and_conversions/02.assignment-like_contexts/widening_prim_call.params.yaml @@ -24,7 +24,7 @@ cases: - { type: byte, val: 0, val2: 0 } - { type: byte, val: 127, val2: 127 } - { type: byte, val: -128, val2: -128 } - - { type: char, val: 0, val2: 0 } + - { type: char, val: Int.toChar(0), val2: 0 } - { type: char, val: "c'\\uFFFF'", val2: 0x0000FFFF } - { type: short, val: 0, val2: 0 } - { type: short, val: 32_767, val2: 32_767 } @@ -35,7 +35,7 @@ cases: - { type: byte, val: 0, val2: ((0).toLong())} - { type: byte, val: 127, val2: ((127).toLong()) } - { type: byte, val: -128, val2: ((-128).toLong()) } - - { type: char, val: 0, val2: ((0).toLong()) } + - { type: char, val: Int.toChar(0), val2: ((0).toLong()) } - { type: char, val: "c'\\uFFFF'", val2: ((0x000000000000FFFF).toLong()) } - { type: short, val: 0, val2: ((0).toLong()) } - { type: short, val: 32_767, val2: ((32_767).toLong()) } @@ -49,7 +49,7 @@ cases: - { type: byte, val: 0, val2: (0.0f) } - { type: byte, val: 127, val2: (127.0f) } - { type: byte, val: -128, val2: (-128.0f) } - - { type: char, val: 0, val2: (0.0f) } + - { type: char, val: Int.toChar(0), val2: (0.0f) } - { type: char, val: "c'\\uFFFF'", val2: (65535.0f)} - { type: short, val: 0, val2: (0.0f) } - { type: short, val: 32_767, val2: (32_767.0f) } @@ -66,7 +66,7 @@ cases: - { type: byte, val: 0, val2: 0.0 } - { type: byte, val: 127, val2: 127.0 } - { type: byte, val: -128, val2: -128.0 } - - { type: char, val: 0, val2: 0.0 } + - { type: char, val: Int.toChar(0), val2: 0.0 } - { type: char, val: "c'\\uFAFF'", val2: 64255.0 } - { type: short, val: 0, val2: 0.0 } - { type: short, val: 32_767, val2: 32_767.0 } diff --git a/static_core/plugins/ets/tests/ets-templates/09.classes/02.class_extension_clause/method_return_value/method_return_value_20.ets b/static_core/plugins/ets/tests/ets-templates/09.classes/02.class_extension_clause/method_return_value/method_return_value_20.ets index 479e9e2113..858f11ebce 100755 --- a/static_core/plugins/ets/tests/ets-templates/09.classes/02.class_extension_clause/method_return_value/method_return_value_20.ets +++ b/static_core/plugins/ets/tests/ets-templates/09.classes/02.class_extension_clause/method_return_value/method_return_value_20.ets @@ -20,7 +20,7 @@ name: method_return_value_20 class Parent { public getValue(): char { - return 100; + return Int.toChar(100); } } -- Gitee