From f7c7b2d165f3a0f6b41f371c0b93bd0791a777a5 Mon Sep 17 00:00:00 2001 From: lirismankarina Date: Mon, 16 Jun 2025 17:58:20 +0300 Subject: [PATCH] [ark] Change `as` expression to CTE Issue: https://gitee.com/openharmony/arkcompiler_ets_frontend/issues/ICXAR6 Description: Switching warning to CTE Reason: Need to update frontend from the view of spec Tests: Fixed according to the latest spec Change-Id: I3f5abb957b8d8e2ef2970416d17464722419fefb Signed-off-by: lirismankarina --- .../ets/sdk/api/@ohos.util.LightWeightSet.ets | 2 +- .../ets/sdk/arkts/@arkts.collections.ets | 4 +- .../plugins/ets/stdlib/escompat/taskpool.ets | 2 +- .../plugins/ets/stdlib/std/core/Console.ets | 4 +- .../plugins/ets/stdlib/std/core/String.ets | 2 +- .../array_ops/array_region_float_test.ets | 14 ++-- .../fixedarray_region_float_test.ets | 4 +- .../call_object_method_float_test.ets | 4 +- .../ets/tests/checked/ani/direct_native.ets | 4 +- .../ets/tests/checked/ani/quick_native.ets | 48 +++++++------- .../escompat_array_get_set_derived.ets | 2 +- .../ets/tests/checked/ets_isFinite.ets | 2 +- .../plugins/ets/tests/checked/ets_isNaN.ets | 2 +- .../plugins/ets/tests/checked/ets_max.ets | 10 +-- .../plugins/ets/tests/checked/ets_min.ets | 10 +-- .../tests/checked/optimize_doubled_xor.ets | 4 +- .../bouncing_pandas/bouncing_pandas.ets | 6 +- .../intrinsics/bigint64array_sort.ets | 2 +- .../intrinsics/biguint64array_sort.ets | 4 +- .../intrinsics/int16array_sort.ets | 2 +- .../intrinsics/int32array_sort.ets | 2 +- .../ets-common-tests/intrinsics/isFinite.ets | 2 +- .../ets-common-tests/intrinsics/isInteger.ets | 2 +- .../ets-common-tests/intrinsics/isNaN.ets | 2 +- .../intrinsics/isSafeInteger.ets | 2 +- .../tests/ets-common-tests/intrinsics/max.ets | 10 +-- .../tests/ets-common-tests/intrinsics/min.ets | 10 +-- .../intrinsics/to_string_cache.ets | 18 +++--- .../01.numeric_types/hier1.params.yaml | 10 +-- .../equal/equal_float.params.yaml | 2 +- .../greater_or_equal_float.params.yaml | 4 +- .../greater_than_float.params.yaml | 4 +- .../less_or_equal_float.params.yaml | 2 +- .../04.accessible/type_name_class_field.ets | 2 +- .../opt_param.params.yaml | 2 +- .../generic_function_constraint.params.yaml | 2 +- ...ic_method_with_body_constraint.params.yaml | 4 +- .../decl_const/decl-const-n.params.yaml | 12 ++-- .../decl_var/decl-var-n.params.yaml | 12 ++-- .../arr_inf2_num2.params.yaml | 12 ++-- .../bigint_equality_operators/eq.params.yaml | 4 +- .../bigint_equality_operators/ne1.params.yaml | 4 +- .../bigint_equality_operators/ne2.params.yaml | 4 +- .../siexp.params.yaml | 20 +++--- .../constant_bitwise_expression.params.yaml | 6 +- .../constant_logical_expression.params.yaml | 14 ++-- .../check_array/constant_shift.params.yaml | 6 +- .../single_class_overload_n.params.yaml | 44 ++++++------- .../cond_t1.params.yaml | 2 +- .../cond_t2.params.yaml | 4 +- .../do_t.params.yaml | 4 +- .../for_t.params.yaml | 4 +- .../if_t1.params.yaml | 4 +- .../if_t2.params.yaml | 4 +- .../while_t.params.yaml | 4 +- .../02.fixed_array_types/far1.params.yaml | 4 +- .../02.fixed_array_types/far2.params.yaml | 4 +- .../cm_over1.params.yaml | 28 ++++---- .../prim_unboxing.params.yaml | 2 +- .../unboxing.params.yaml | 2 +- .../predef_ref.ets | 8 +-- .../predef_ref.params.yaml | 6 +- .../identity.params.yaml | 2 +- .../invalid.params.yaml | 4 +- .../widening_refs.params.yaml | 4 +- .../assn_var/assn-var-un.params.yaml | 2 +- .../assn_var/assn-var-wd.params.yaml | 12 ++-- .../call_cons/call-cons-un.params.yaml | 2 +- .../call_cons/call-cons-wd.params.yaml | 12 ++-- .../call_func/call-func-un.params.yaml | 2 +- .../call_func/call-func-wd.params.yaml | 12 ++-- .../call_lmbd/call-lmbd-un.params.yaml | 2 +- .../call_lmbd/call-lmbd-wd.params.yaml | 12 ++-- .../call_meth/call-meth-un.params.yaml | 2 +- .../call_meth/call-meth-wd.params.yaml | 12 ++-- .../comp_arr/comp-arr-un.params.yaml | 2 +- .../comp_arr/comp-arr-wd.params.yaml | 12 ++-- .../comp_obj/comp-obj-un.params.yaml | 2 +- .../comp_obj/comp-obj-wd.params.yaml | 12 ++-- .../decl_field/decl-field-un.params.yaml | 2 +- .../decl_field/decl-field-wd.params.yaml | 12 ++-- .../decl_var/decl-var-un.params.yaml | 2 +- .../decl_var/decl-var-wd.params.yaml | 12 ++-- .../assn_var/assn-var.params.yaml | 11 ++-- .../call_cons/call-cons.params.yaml | 12 ++-- .../call_func/call-func.params.yaml | 12 ++-- .../call_lmbd/call-lmbd.params.yaml | 12 ++-- .../call_meth/call-meth.params.yaml | 12 ++-- .../comp_arr/comp-arr.params.yaml | 12 ++-- .../comp_obj/comp-clss.params.yaml | 12 ++-- .../comp_obj/comp-intf.params.yaml | 12 ++-- .../decl_const/decl-const.params.yaml | 6 +- .../decl_field/decl-field.params.yaml | 6 +- .../decl_var/decl-var.params.yaml | 6 +- .../escompat/ArrayTestDerived.ets | 4 +- .../tests/ets_func_tests/regression/16657.ets | 4 +- .../expr/numeric-float-nonzero-expression.ets | 2 +- ...at-nonzero-ternary-operator-expression.ets | 2 +- .../numeric-float-zero-epsilon-expression.ets | 2 +- .../expr/numeric-float-zero-expression.ets | 2 +- .../numeric-float-zero-object-expression.ets | 2 +- ...float-zero-ternary-operator-expression.ets | 2 +- .../loop/numeric-loop-do-while-float-in.ets | 2 +- .../loop/numeric-loop-do-while-float.ets | 2 +- .../loop/numeric-loop-while-float-in.ets | 2 +- .../numeric/loop/numeric-loop-while-float.ets | 2 +- .../std/core/TypeCreateInterfaceTest.ets | 2 +- .../ets_sdk/api/@ohos/buffer/BufferTests.ets | 10 +-- .../PlainArrayForEachIteratorTests.ets | 2 +- .../util/PlainArray/PlainArrayForEachTest.ets | 6 +- .../XmlSerializerSetAttributesTest.ets | 2 +- .../ets_test_suite/gc/stress/test_gc_old.ets | 28 ++++---- .../equality/equality_primitive_01.ets | 6 +- .../equality/list.equality_primitive_01.yaml | 64 +++++++++---------- .../core/list.std_core_type_array_type.yaml | 2 +- .../std/core/list.std_core_value.yaml | 6 +- .../list.std_serialization_json_static.yaml | 4 +- .../utils/test_core_typedarray_methods.j2 | 2 +- 118 files changed, 419 insertions(+), 422 deletions(-) diff --git a/static_core/plugins/ets/sdk/api/@ohos.util.LightWeightSet.ets b/static_core/plugins/ets/sdk/api/@ohos.util.LightWeightSet.ets index 753f9df7b9..4ab1a6d0ac 100644 --- a/static_core/plugins/ets/sdk/api/@ohos.util.LightWeightSet.ets +++ b/static_core/plugins/ets/sdk/api/@ohos.util.LightWeightSet.ets @@ -224,7 +224,7 @@ export class LightWeightSet implements ReadonlyLightWeightSet, JsonReplace } else { const hashCode = this.hash(key); let low: int = 0; - let high: int = this.buckets.length - 1; + let high: int = this.buckets.length.toInt() - 1; while (low <= high) { const mid = (low + high) >>> 1; const midHash = this.hash(this.buckets.getKeyAt(mid)!); diff --git a/static_core/plugins/ets/sdk/arkts/@arkts.collections.ets b/static_core/plugins/ets/sdk/arkts/@arkts.collections.ets index 335c6ffc78..b5c780233b 100644 --- a/static_core/plugins/ets/sdk/arkts/@arkts.collections.ets +++ b/static_core/plugins/ets/sdk/arkts/@arkts.collections.ets @@ -87,7 +87,7 @@ export namespace collections { if (length === 0) { this.buffer = new Array(); } else { - this._length = length; + this._length = length.toInt(); this.buffer = Array.create(this.getUsedCapacity(), 0); } } @@ -368,7 +368,7 @@ export namespace collections { throw createBusinessError(OutOfBoundsErrorCodeId, `The value of \"length\" is out of range. It must be >= 0. Received value is: ${size}`); } - let sizeInt: int = size; + let sizeInt: int = size.toInt(); if (this._length >= sizeInt) { this._length = sizeInt; return; diff --git a/static_core/plugins/ets/stdlib/escompat/taskpool.ets b/static_core/plugins/ets/stdlib/escompat/taskpool.ets index 3265a567a9..0ccfa6cf42 100644 --- a/static_core/plugins/ets/stdlib/escompat/taskpool.ets +++ b/static_core/plugins/ets/stdlib/escompat/taskpool.ets @@ -1556,7 +1556,7 @@ export namespace taskpool { function getTaskPoolWorkersNum(): int { let num = 0; ConcurrencyHelpers.lockGuard(workersMutex, () => { - num = workers.size; + num = workers.size.toInt(); }); return num; } diff --git a/static_core/plugins/ets/stdlib/std/core/Console.ets b/static_core/plugins/ets/stdlib/std/core/Console.ets index 0eb5663e1a..6273f4eb39 100644 --- a/static_core/plugins/ets/stdlib/std/core/Console.ets +++ b/static_core/plugins/ets/stdlib/std/core/Console.ets @@ -882,8 +882,8 @@ export final class Console { let stringVal = Rows[j * indexNum + i]; let stringLen = Console.getStringLen(stringVal); if (stringLen > 0) { - let left:int = ((columnWidths[j] - stringLen) / 2) as int; - let right:int = (columnWidths[j] - stringLen - left) as int; + let left:int = ((columnWidths[j] - stringLen) / 2).toInt(); + let right:int = (columnWidths[j] - stringLen - left).toInt(); result += Console.stringRepeat(left, " ") + stringVal + Console.stringRepeat(right, " "); } else { result += Console.stringRepeat(columnWidths[j], " "); diff --git a/static_core/plugins/ets/stdlib/std/core/String.ets b/static_core/plugins/ets/stdlib/std/core/String.ets index 34827095ad..1a8476c2ea 100644 --- a/static_core/plugins/ets/stdlib/std/core/String.ets +++ b/static_core/plugins/ets/stdlib/std/core/String.ets @@ -1533,7 +1533,7 @@ export final class String extends Object implements Comparable, Iterable } let preceding = this.substring(0, position) let following = this.substring(position + searchLength) - let replacement = replacer(searchValue, [position.toDouble() as Object, this as Object] as Object[]) + let replacement = replacer(searchValue, [new Double(position.toDouble()) as Object, this as Object] as Object[]) return preceding + replacement + following } diff --git a/static_core/plugins/ets/tests/ani/tests/array_ops/array_region_float_test.ets b/static_core/plugins/ets/tests/ani/tests/array_ops/array_region_float_test.ets index 4ddb4e6315..f0715e61a4 100644 --- a/static_core/plugins/ets/tests/ani/tests/array_ops/array_region_float_test.ets +++ b/static_core/plugins/ets/tests/ani/tests/array_ops/array_region_float_test.ets @@ -17,8 +17,8 @@ class ArrayClass { public static array: float[] = [1.0f, 2.0f, 3.0f, 4.0f, 5.0f] public static changeStaticArray() { - ArrayClass.array[2] = 22.0 as float - ArrayClass.array[4] = 44.0 as float + ArrayClass.array[2] = 22.0f + ArrayClass.array[4] = 44.0f } public static checkStaticArray(): boolean { @@ -40,11 +40,11 @@ function getArray(): float[] { function getEscompatArray(): Array { let a: Array = new Array(5) - a[0] = 1.0 as float - a[1] = 2.0 as float - a[2] = 3.0 as float - a[3] = 4.0 as float - a[4] = 5.0 as float + a[0] = 1.0f + a[1] = 2.0f + a[2] = 3.0f + a[3] = 4.0f + a[4] = 5.0f return a } diff --git a/static_core/plugins/ets/tests/ani/tests/fixedarray_ops/fixedarray_region_float_test.ets b/static_core/plugins/ets/tests/ani/tests/fixedarray_ops/fixedarray_region_float_test.ets index dfd780cac8..c6a72ad25c 100644 --- a/static_core/plugins/ets/tests/ani/tests/fixedarray_ops/fixedarray_region_float_test.ets +++ b/static_core/plugins/ets/tests/ani/tests/fixedarray_ops/fixedarray_region_float_test.ets @@ -17,8 +17,8 @@ class ArrayClass { public static array: FixedArray = [1.0f, 2.0f, 3.0f, 4.0f, 5.0f] public static changeStaticArray() { - ArrayClass.array[2] = 22.0 as float - ArrayClass.array[4] = 44.0 as float + ArrayClass.array[2] = 22.0f + ArrayClass.array[4] = 44.0f } public static checkStaticArray(): boolean { diff --git a/static_core/plugins/ets/tests/ani/tests/object_ops/call_object_method_float_test.ets b/static_core/plugins/ets/tests/ani/tests/object_ops/call_object_method_float_test.ets index c91e4f95c8..c6e4c33a88 100644 --- a/static_core/plugins/ets/tests/ani/tests/object_ops/call_object_method_float_test.ets +++ b/static_core/plugins/ets/tests/ani/tests/object_ops/call_object_method_float_test.ets @@ -26,7 +26,7 @@ class A { public floatMethodVoidParam(): float { - return 5.0 as float; + return 5.0f; } public floatMethodMultipleParam(a0: short, a1: boolean, a2:float, a3:short, a4:float): float @@ -63,7 +63,7 @@ final class B extends A { public subFloatMethodVoidParam(): float { - return 8.0 as float; + return 8.0f; } } diff --git a/static_core/plugins/ets/tests/checked/ani/direct_native.ets b/static_core/plugins/ets/tests/checked/ani/direct_native.ets index b05d104143..b5964d22dd 100644 --- a/static_core/plugins/ets/tests/checked/ani/direct_native.ets +++ b/static_core/plugins/ets/tests/checked/ani/direct_native.ets @@ -61,9 +61,9 @@ function test(i0: byte, i1: short, i2: int, i3: long, f0: float, f1: double, f2: function main(): int { let res = 0; for (let i = 0; i < 100; ++i) { - res = test(0 as byte, 1 as short, 2, 3 as long, 0.0 as float, 1.0, 2.0, + res = test(0 as byte, 1 as short, 2, 3 as long, 0.0f, 1.0, 2.0, 4, 5, 6, 7 as long, 8, 9 as short, 10, 11, 12, 13, 14, - 3.0 as float, 4.0 as float, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0); + 3.0f, 4.0f, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0); if (res != 0) { return res; } diff --git a/static_core/plugins/ets/tests/checked/ani/quick_native.ets b/static_core/plugins/ets/tests/checked/ani/quick_native.ets index 7cfa1cf4e1..f0f19c86c4 100644 --- a/static_core/plugins/ets/tests/checked/ani/quick_native.ets +++ b/static_core/plugins/ets/tests/checked/ani/quick_native.ets @@ -155,10 +155,10 @@ class TestResult { return 16; } - if (this.f0.value != 0.0 as float) { + if (this.f0.value != 0.0f) { return 17; } - if (this.f1 != 1.0 as float) { + if (this.f1 != 1.0f) { return 18; } if (this.f2.value != 2.0 as double) { @@ -167,10 +167,10 @@ class TestResult { if (this.f3 != 3.0 as double) { return 20; } - if (this.f4.value != 4.0 as float) { + if (this.f4.value != 4.0f) { return 21; } - if (this.f5 != 5.0 as float) { + if (this.f5 != 5.0f) { return 22; } if (this.f6.value != 6.0 as double) { @@ -179,10 +179,10 @@ class TestResult { if (this.f7 != 7.0 as double) { return 24; } - if (this.f8.value != 8.0 as float) { + if (this.f8.value != 8.0f) { return 25; } - if (this.f9 != 9.0 as float) { + if (this.f9 != 9.0f) { return 26; } if (this.f10.value != 10.0 as double) { @@ -191,10 +191,10 @@ class TestResult { if (this.f11 != 11.0 as double) { return 28; } - if (this.f12.value != 12.0 as float) { + if (this.f12.value != 12.0f) { return 29; } - if (this.f13 != 13.0 as float) { + if (this.f13 != 13.0f) { return 30; } if (this.f14.value != 14.0 as double) { @@ -302,8 +302,8 @@ export class NativeModule { function testGeneralStaticPrim(): TestResult { let tr = new TestResult(new ByteWrapper(0 as byte), 1 as byte, new ShortWrapper(2 as short), 3 as short, new IntWrapper(4 as int), 5 as int, new LongWrapper(6 as long), 7 as long, new ByteWrapper(8 as byte), 9 as byte, new ShortWrapper(10 as short), 11 as short, new IntWrapper(12 as int), 13 as int, new LongWrapper(14 as long), 15 as long, - new FloatWrapper(0.0 as float), 1.0 as float, new DoubleWrapper(2.0 as double), 3.0 as double, new FloatWrapper(4.0 as float), 5.0 as float, new DoubleWrapper(6.0 as double), 7.0 as double, - new FloatWrapper(8.0 as float), 9.0 as float, new DoubleWrapper(10.0 as double), 11.0 as double, new FloatWrapper(12.0 as float), 13.0 as float, new DoubleWrapper(14.0 as double), 15.0 as double); + new FloatWrapper(0.0f), 1.0f, new DoubleWrapper(2.0 as double), 3.0 as double, new FloatWrapper(4.0f), 5.0f, new DoubleWrapper(6.0 as double), 7.0 as double, + new FloatWrapper(8.0f), 9.0f, new DoubleWrapper(10.0 as double), 11.0 as double, new FloatWrapper(12.0f), 13.0f, new DoubleWrapper(14.0 as double), 15.0 as double); let res = NativeModule.generalStaticPrim(tr.i0, tr.i1, tr.i2, tr.i3, tr.i4, tr.i5, tr.i6, tr.i7, tr.i8, tr.i9, tr.i10, tr.i11, tr.i12, tr.i13, tr.i14, tr.i15, tr.f0, tr.f1, tr.f2, tr.f3, tr.f4, tr.f5, tr.f6, tr.f7, tr.f8, tr.f9, tr.f10, tr.f11, tr.f12, tr.f13, tr.f14, tr.f15); tr.res = new IntWrapper(res); @@ -313,8 +313,8 @@ function testGeneralStaticPrim(): TestResult { function testQuickStaticPrim(): TestResult { let tr = new TestResult(new ByteWrapper(0 as byte), 1 as byte, new ShortWrapper(2 as short), 3 as short, new IntWrapper(4 as int), 5 as int, new LongWrapper(6 as long), 7 as long, new ByteWrapper(8 as byte), 9 as byte, new ShortWrapper(10 as short), 11 as short, new IntWrapper(12 as int), 13 as int, new LongWrapper(14 as long), 15 as long, - new FloatWrapper(0.0 as float), 1.0 as float, new DoubleWrapper(2.0 as double), 3.0 as double, new FloatWrapper(4.0 as float), 5.0 as float, new DoubleWrapper(6.0 as double), 7.0 as double, - new FloatWrapper(8.0 as float), 9.0 as float, new DoubleWrapper(10.0 as double), 11.0 as double, new FloatWrapper(12.0 as float), 13.0 as float, new DoubleWrapper(14.0 as double), 15.0 as double); + new FloatWrapper(0.0f), 1.0f, new DoubleWrapper(2.0 as double), 3.0 as double, new FloatWrapper(4.0f), 5.0f, new DoubleWrapper(6.0 as double), 7.0 as double, + new FloatWrapper(8.0f), 9.0f, new DoubleWrapper(10.0 as double), 11.0 as double, new FloatWrapper(12.0f), 13.0f, new DoubleWrapper(14.0 as double), 15.0 as double); let res = NativeModule.quickStaticPrim(tr.i0, tr.i1, tr.i2, tr.i3, tr.i4, tr.i5, tr.i6, tr.i7, tr.i8, tr.i9, tr.i10, tr.i11, tr.i12, tr.i13, tr.i14, tr.i15, tr.f0, tr.f1, tr.f2, tr.f3, tr.f4, tr.f5, tr.f6, tr.f7, tr.f8, tr.f9, tr.f10, tr.f11, tr.f12, tr.f13, tr.f14, tr.f15); tr.res = new IntWrapper(res); @@ -324,8 +324,8 @@ function testQuickStaticPrim(): TestResult { function testGeneralStaticObj(): TestResult { let tr = new TestResult(new ByteWrapper(0 as byte), 1 as byte, new ShortWrapper(2 as short), 3 as short, new IntWrapper(4 as int), 5 as int, new LongWrapper(6 as long), 7 as long, new ByteWrapper(8 as byte), 9 as byte, new ShortWrapper(10 as short), 11 as short, new IntWrapper(12 as int), 13 as int, new LongWrapper(14 as long), 15 as long, - new FloatWrapper(0.0 as float), 1.0 as float, new DoubleWrapper(2.0 as double), 3.0 as double, new FloatWrapper(4.0 as float), 5.0 as float, new DoubleWrapper(6.0 as double), 7.0 as double, - new FloatWrapper(8.0 as float), 9.0 as float, new DoubleWrapper(10.0 as double), 11.0 as double, new FloatWrapper(12.0 as float), 13.0 as float, new DoubleWrapper(14.0 as double), 15.0 as double); + new FloatWrapper(0.0f), 1.0f, new DoubleWrapper(2.0 as double), 3.0 as double, new FloatWrapper(4.0f), 5.0f, new DoubleWrapper(6.0 as double), 7.0 as double, + new FloatWrapper(8.0f), 9.0f, new DoubleWrapper(10.0 as double), 11.0 as double, new FloatWrapper(12.0f), 13.0f, new DoubleWrapper(14.0 as double), 15.0 as double); let res = NativeModule.generalStaticObj(tr.i0, tr.i1, tr.i2, tr.i3, tr.i4, tr.i5, tr.i6, tr.i7, tr.i8, tr.i9, tr.i10, tr.i11, tr.i12, tr.i13, tr.i14, tr.i15, tr.f0, tr.f1, tr.f2, tr.f3, tr.f4, tr.f5, tr.f6, tr.f7, tr.f8, tr.f9, tr.f10, tr.f11, tr.f12, tr.f13, tr.f14, tr.f15); tr.res = res; @@ -335,8 +335,8 @@ function testGeneralStaticObj(): TestResult { function testQuickStaticObj(): TestResult { let tr = new TestResult(new ByteWrapper(0 as byte), 1 as byte, new ShortWrapper(2 as short), 3 as short, new IntWrapper(4 as int), 5 as int, new LongWrapper(6 as long), 7 as long, new ByteWrapper(8 as byte), 9 as byte, new ShortWrapper(10 as short), 11 as short, new IntWrapper(12 as int), 13 as int, new LongWrapper(14 as long), 15 as long, - new FloatWrapper(0.0 as float), 1.0 as float, new DoubleWrapper(2.0 as double), 3.0 as double, new FloatWrapper(4.0 as float), 5.0 as float, new DoubleWrapper(6.0 as double), 7.0 as double, - new FloatWrapper(8.0 as float), 9.0 as float, new DoubleWrapper(10.0 as double), 11.0 as double, new FloatWrapper(12.0 as float), 13.0 as float, new DoubleWrapper(14.0 as double), 15.0 as double); + new FloatWrapper(0.0f), 1.0f, new DoubleWrapper(2.0 as double), 3.0 as double, new FloatWrapper(4.0f), 5.0f, new DoubleWrapper(6.0 as double), 7.0 as double, + new FloatWrapper(8.0f), 9.0f, new DoubleWrapper(10.0 as double), 11.0 as double, new FloatWrapper(12.0f), 13.0f, new DoubleWrapper(14.0 as double), 15.0 as double); let res = NativeModule.quickStaticObj(tr.i0, tr.i1, tr.i2, tr.i3, tr.i4, tr.i5, tr.i6, tr.i7, tr.i8, tr.i9, tr.i10, tr.i11, tr.i12, tr.i13, tr.i14, tr.i15, tr.f0, tr.f1, tr.f2, tr.f3, tr.f4, tr.f5, tr.f6, tr.f7, tr.f8, tr.f9, tr.f10, tr.f11, tr.f12, tr.f13, tr.f14, tr.f15); tr.res = res; @@ -346,8 +346,8 @@ function testQuickStaticObj(): TestResult { function testGeneralVirtualFinalPrim(): TestResult { let tr = new TestResult(new ByteWrapper(0 as byte), 1 as byte, new ShortWrapper(2 as short), 3 as short, new IntWrapper(4 as int), 5 as int, new LongWrapper(6 as long), 7 as long, new ByteWrapper(8 as byte), 9 as byte, new ShortWrapper(10 as short), 11 as short, new IntWrapper(12 as int), 13 as int, new LongWrapper(14 as long), 15 as long, - new FloatWrapper(0.0 as float), 1.0 as float, new DoubleWrapper(2.0 as double), 3.0 as double, new FloatWrapper(4.0 as float), 5.0 as float, new DoubleWrapper(6.0 as double), 7.0 as double, - new FloatWrapper(8.0 as float), 9.0 as float, new DoubleWrapper(10.0 as double), 11.0 as double, new FloatWrapper(12.0 as float), 13.0 as float, new DoubleWrapper(14.0 as double), 15.0 as double); + new FloatWrapper(0.0f), 1.0f, new DoubleWrapper(2.0 as double), 3.0 as double, new FloatWrapper(4.0f), 5.0f, new DoubleWrapper(6.0 as double), 7.0 as double, + new FloatWrapper(8.0f), 9.0f, new DoubleWrapper(10.0 as double), 11.0 as double, new FloatWrapper(12.0f), 13.0f, new DoubleWrapper(14.0 as double), 15.0 as double); let res = (new NativeModule).generalVirtualFinalPrim(tr.i0, tr.i1, tr.i2, tr.i3, tr.i4, tr.i5, tr.i6, tr.i7, tr.i8, tr.i9, tr.i10, tr.i11, tr.i12, tr.i13, tr.i14, tr.i15, tr.f0, tr.f1, tr.f2, tr.f3, tr.f4, tr.f5, tr.f6, tr.f7, tr.f8, tr.f9, tr.f10, tr.f11, tr.f12, tr.f13, tr.f14, tr.f15); tr.res = new IntWrapper(res); @@ -357,8 +357,8 @@ function testGeneralVirtualFinalPrim(): TestResult { function testQuickVirtualFinalPrim(): TestResult { let tr = new TestResult(new ByteWrapper(0 as byte), 1 as byte, new ShortWrapper(2 as short), 3 as short, new IntWrapper(4 as int), 5 as int, new LongWrapper(6 as long), 7 as long, new ByteWrapper(8 as byte), 9 as byte, new ShortWrapper(10 as short), 11 as short, new IntWrapper(12 as int), 13 as int, new LongWrapper(14 as long), 15 as long, - new FloatWrapper(0.0 as float), 1.0 as float, new DoubleWrapper(2.0 as double), 3.0 as double, new FloatWrapper(4.0 as float), 5.0 as float, new DoubleWrapper(6.0 as double), 7.0 as double, - new FloatWrapper(8.0 as float), 9.0 as float, new DoubleWrapper(10.0 as double), 11.0 as double, new FloatWrapper(12.0 as float), 13.0 as float, new DoubleWrapper(14.0 as double), 15.0 as double); + new FloatWrapper(0.0f), 1.0f, new DoubleWrapper(2.0 as double), 3.0 as double, new FloatWrapper(4.0f), 5.0f, new DoubleWrapper(6.0 as double), 7.0 as double, + new FloatWrapper(8.0f), 9.0f, new DoubleWrapper(10.0 as double), 11.0 as double, new FloatWrapper(12.0f), 13.0f, new DoubleWrapper(14.0 as double), 15.0 as double); let res = (new NativeModule).quickVirtualFinalPrim(tr.i0, tr.i1, tr.i2, tr.i3, tr.i4, tr.i5, tr.i6, tr.i7, tr.i8, tr.i9, tr.i10, tr.i11, tr.i12, tr.i13, tr.i14, tr.i15, tr.f0, tr.f1, tr.f2, tr.f3, tr.f4, tr.f5, tr.f6, tr.f7, tr.f8, tr.f9, tr.f10, tr.f11, tr.f12, tr.f13, tr.f14, tr.f15); tr.res = new IntWrapper(res); @@ -368,8 +368,8 @@ function testQuickVirtualFinalPrim(): TestResult { function testGeneralVirtualFinalObj(): TestResult { let tr = new TestResult(new ByteWrapper(0 as byte), 1 as byte, new ShortWrapper(2 as short), 3 as short, new IntWrapper(4 as int), 5 as int, new LongWrapper(6 as long), 7 as long, new ByteWrapper(8 as byte), 9 as byte, new ShortWrapper(10 as short), 11 as short, new IntWrapper(12 as int), 13 as int, new LongWrapper(14 as long), 15 as long, - new FloatWrapper(0.0 as float), 1.0 as float, new DoubleWrapper(2.0 as double), 3.0 as double, new FloatWrapper(4.0 as float), 5.0 as float, new DoubleWrapper(6.0 as double), 7.0 as double, - new FloatWrapper(8.0 as float), 9.0 as float, new DoubleWrapper(10.0 as double), 11.0 as double, new FloatWrapper(12.0 as float), 13.0 as float, new DoubleWrapper(14.0 as double), 15.0 as double); + new FloatWrapper(0.0f), 1.0f, new DoubleWrapper(2.0 as double), 3.0 as double, new FloatWrapper(4.0f), 5.0f, new DoubleWrapper(6.0 as double), 7.0 as double, + new FloatWrapper(8.0f), 9.0f, new DoubleWrapper(10.0 as double), 11.0 as double, new FloatWrapper(12.0f), 13.0f, new DoubleWrapper(14.0 as double), 15.0 as double); let res = (new NativeModule).generalVirtualFinalObj(tr.i0, tr.i1, tr.i2, tr.i3, tr.i4, tr.i5, tr.i6, tr.i7, tr.i8, tr.i9, tr.i10, tr.i11, tr.i12, tr.i13, tr.i14, tr.i15, tr.f0, tr.f1, tr.f2, tr.f3, tr.f4, tr.f5, tr.f6, tr.f7, tr.f8, tr.f9, tr.f10, tr.f11, tr.f12, tr.f13, tr.f14, tr.f15); tr.res = res; @@ -379,8 +379,8 @@ function testGeneralVirtualFinalObj(): TestResult { function testQuickVirtualFinalObj(): TestResult { let tr = new TestResult(new ByteWrapper(0 as byte), 1 as byte, new ShortWrapper(2 as short), 3 as short, new IntWrapper(4 as int), 5 as int, new LongWrapper(6 as long), 7 as long, new ByteWrapper(8 as byte), 9 as byte, new ShortWrapper(10 as short), 11 as short, new IntWrapper(12 as int), 13 as int, new LongWrapper(14 as long), 15 as long, - new FloatWrapper(0.0 as float), 1.0 as float, new DoubleWrapper(2.0 as double), 3.0 as double, new FloatWrapper(4.0 as float), 5.0 as float, new DoubleWrapper(6.0 as double), 7.0 as double, - new FloatWrapper(8.0 as float), 9.0 as float, new DoubleWrapper(10.0 as double), 11.0 as double, new FloatWrapper(12.0 as float), 13.0 as float, new DoubleWrapper(14.0 as double), 15.0 as double); + new FloatWrapper(0.0f), 1.0f, new DoubleWrapper(2.0 as double), 3.0 as double, new FloatWrapper(4.0f), 5.0f, new DoubleWrapper(6.0 as double), 7.0 as double, + new FloatWrapper(8.0f), 9.0f, new DoubleWrapper(10.0 as double), 11.0 as double, new FloatWrapper(12.0f), 13.0f, new DoubleWrapper(14.0 as double), 15.0 as double); let res = (new NativeModule).quickVirtualFinalObj(tr.i0, tr.i1, tr.i2, tr.i3, tr.i4, tr.i5, tr.i6, tr.i7, tr.i8, tr.i9, tr.i10, tr.i11, tr.i12, tr.i13, tr.i14, tr.i15, tr.f0, tr.f1, tr.f2, tr.f3, tr.f4, tr.f5, tr.f6, tr.f7, tr.f8, tr.f9, tr.f10, tr.f11, tr.f12, tr.f13, tr.f14, tr.f15); tr.res = res; diff --git a/static_core/plugins/ets/tests/checked/escompat_array_get_set_derived.ets b/static_core/plugins/ets/tests/checked/escompat_array_get_set_derived.ets index 776fca727c..f19cfcbce9 100644 --- a/static_core/plugins/ets/tests/checked/escompat_array_get_set_derived.ets +++ b/static_core/plugins/ets/tests/checked/escompat_array_get_set_derived.ets @@ -156,7 +156,7 @@ function __noinline__testWithRandomBranch(branch: int): void { } function __noinline__getRandomBranch() { - return (Date.now() % NUM_ARRAY_BRANCHES) as int; + return (Date.now() % NUM_ARRAY_BRANCHES).toInt(); } function test1(): void { diff --git a/static_core/plugins/ets/tests/checked/ets_isFinite.ets b/static_core/plugins/ets/tests/checked/ets_isFinite.ets index 5c52692752..8c31234e26 100644 --- a/static_core/plugins/ets/tests/checked/ets_isFinite.ets +++ b/static_core/plugins/ets/tests/checked/ets_isFinite.ets @@ -75,7 +75,7 @@ function check_isfinite_f32() : int { if (Float.isFinite(Float.NEGATIVE_INFINITY)) return 3; if (!Float.isFinite(Float.MAX_VALUE)) return 4; if (!Float.isFinite(Float.MIN_VALUE)) return 5; - if (!Float.isFinite(1.2345 as float)) return 6; + if (!Float.isFinite(1.2345f)) return 6; return 0; } diff --git a/static_core/plugins/ets/tests/checked/ets_isNaN.ets b/static_core/plugins/ets/tests/checked/ets_isNaN.ets index 51829c87d9..ee4355f127 100644 --- a/static_core/plugins/ets/tests/checked/ets_isNaN.ets +++ b/static_core/plugins/ets/tests/checked/ets_isNaN.ets @@ -63,7 +63,7 @@ function check_isnan_f32() : int { if (Float.isNaN(Float.NEGATIVE_INFINITY)) return 3; if (Float.isNaN(Float.MAX_VALUE)) return 4; if (Float.isNaN(Float.MIN_VALUE)) return 5; - if (Float.isNaN(1.2345 as float)) return 6; + if (Float.isNaN(1.2345f)) return 6; return 0; } diff --git a/static_core/plugins/ets/tests/checked/ets_max.ets b/static_core/plugins/ets/tests/checked/ets_max.ets index 4fe287cb41..07074e2b27 100644 --- a/static_core/plugins/ets/tests/checked/ets_max.ets +++ b/static_core/plugins/ets/tests/checked/ets_max.ets @@ -103,12 +103,12 @@ function test_i64() : int { function test_f32() : int { if (max(Float.POSITIVE_INFINITY, Float.NEGATIVE_INFINITY) != Float.POSITIVE_INFINITY) return 21; if (max(Float.MAX_VALUE, Float.NEGATIVE_INFINITY) != Float.MAX_VALUE) return 22; - if (max(0. as float, Float.NEGATIVE_INFINITY) != 0 as float) return 23; - if (max(0. as float, Float.MIN_VALUE) != Float.MIN_VALUE) return 24; + if (max((0.).toFloat(), Float.NEGATIVE_INFINITY) != 0 as float) return 23; + if (max((0).toFloat(), Float.MIN_VALUE) != Float.MIN_VALUE) return 24; if (max(Float.MAX_VALUE, Float.MIN_VALUE) != Float.MAX_VALUE) return 25; - if (max(0. as float, 2. as float) != 2. as float) return 26; - if (max(0. as float, -4. as float) != 0. as float) return 27; - if (max(1.e-10 as float, 2.e+12 as float) != 2.e+12 as float) return 28; + if (max((0).toFloat(), (2).toFloat()) != (2).toFloat()) return 26; + if (max((0).toFloat(), (-4).toFloat()) != (0).toFloat()) return 27; + if (max((1.e-10).toFloat(), (2.e+12).toFloat()) != (2.e+12).toFloat()) return 28; if (!Float.isNaN(max(Float.NaN, Float.NaN))) return 29; if (!Float.isNaN(max(Float.MAX_VALUE, Float.NaN))) return 30; diff --git a/static_core/plugins/ets/tests/checked/ets_min.ets b/static_core/plugins/ets/tests/checked/ets_min.ets index 0f4f228a00..88341a6286 100644 --- a/static_core/plugins/ets/tests/checked/ets_min.ets +++ b/static_core/plugins/ets/tests/checked/ets_min.ets @@ -103,12 +103,12 @@ function test_i64() : int { function test_f32() : int { if (min(Float.POSITIVE_INFINITY, Float.NEGATIVE_INFINITY) != Float.NEGATIVE_INFINITY) return 21; if (min(Float.MAX_VALUE, Float.NEGATIVE_INFINITY) != Float.NEGATIVE_INFINITY) return 22; - if (min(0. as float, Float.NEGATIVE_INFINITY) != Float.NEGATIVE_INFINITY) return 23; - if (min(0. as float, Float.MIN_VALUE) != 0. as float) return 24; + if (min(0.0f, Float.NEGATIVE_INFINITY) != Float.NEGATIVE_INFINITY) return 23; + if (min(0.0f, Float.MIN_VALUE) != 0.0f) return 24; if (min(Float.MAX_VALUE, Float.MIN_VALUE) != Float.MIN_VALUE) return 25; - if (min(0. as float, 2. as float) != 0. as float) return 26; - if (min(0. as float, -4. as float) != -4. as float) return 27; - if (min(1.e-10 as float, 2.e+12 as float) != 1.e-10 as float) return 28; + if (min(0.0f, 2.0f) != 0.0f) return 26; + if (min(0.0f, -4.0f) != -4.0f) return 27; + if (min((1.e-10).toFloat(), (2.e+12).toFloat()) != (1.e-10).toFloat()) return 28; if (!Float.isNaN(min(Float.NaN, Float.NaN))) return 29; if (!Float.isNaN(min(Float.MAX_VALUE, Float.NaN))) return 30; diff --git a/static_core/plugins/ets/tests/checked/optimize_doubled_xor.ets b/static_core/plugins/ets/tests/checked/optimize_doubled_xor.ets index 28979c328c..234aa905e2 100644 --- a/static_core/plugins/ets/tests/checked/optimize_doubled_xor.ets +++ b/static_core/plugins/ets/tests/checked/optimize_doubled_xor.ets @@ -292,7 +292,7 @@ function test_xor_chain_byte(param: byte): byte { let t: Int = __noinline__dummyReturn() } - return result as byte; + return result.toByte(); } function test_xor_chain_short(param: short): short { @@ -304,7 +304,7 @@ function test_xor_chain_short(param: short): short { let t: Int = __noinline__dummyReturn() } - return result as short; + return result.toShort(); } function test_xor_chain_int(param: int): int { diff --git a/static_core/plugins/ets/tests/common/bouncing_pandas/bouncing_pandas.ets b/static_core/plugins/ets/tests/common/bouncing_pandas/bouncing_pandas.ets index 008d0706c1..ec03a104a0 100644 --- a/static_core/plugins/ets/tests/common/bouncing_pandas/bouncing_pandas.ets +++ b/static_core/plugins/ets/tests/common/bouncing_pandas/bouncing_pandas.ets @@ -133,10 +133,10 @@ function simProcessCollision(a: SBody, b: SBody): void { let shift: float = a.rad + b.rad - rlen as float; if (shift < 0) return; // too far - let n = v2scale(1.0 as float / rlen as float, r); + let n = v2scale(1.0f / rlen as float, r); let mratio: float = b.m / a.m; - let msum: float = 1.0 as float + mratio; - let dvlen: float = (2.0 as float * v2dot(n, v2sub(a.v, b.v)) as float / msum) as float; + let msum: float = 1.0f + mratio; + let dvlen: float = (2.0f * v2dot(n, v2sub(a.v, b.v)) as float / msum) as float; a.v = v2add(a.v, v2scale(-mratio as float * dvlen as float, n)); b.v = v2add(b.v, v2scale(dvlen, n)); a.r = v2add(a.r, v2scale((-mratio * shift) as float / msum as float, n)); diff --git a/static_core/plugins/ets/tests/ets-common-tests/intrinsics/bigint64array_sort.ets b/static_core/plugins/ets/tests/ets-common-tests/intrinsics/bigint64array_sort.ets index defc9abf31..683ca870d3 100644 --- a/static_core/plugins/ets/tests/ets-common-tests/intrinsics/bigint64array_sort.ets +++ b/static_core/plugins/ets/tests/ets-common-tests/intrinsics/bigint64array_sort.ets @@ -32,7 +32,7 @@ function sortEmpty(): void { function sortSingle(): void { let single: BigInt64Array = new BigInt64Array(SINGLE); single.sort(); - arktest.assertEQ(single[0].getLong(), SINGLE[0] as long); + arktest.assertEQ(single[0].getLong(), SINGLE[0].toLong()); } function sortNormal(): void { diff --git a/static_core/plugins/ets/tests/ets-common-tests/intrinsics/biguint64array_sort.ets b/static_core/plugins/ets/tests/ets-common-tests/intrinsics/biguint64array_sort.ets index f4c5ab3a74..52e82725c3 100644 --- a/static_core/plugins/ets/tests/ets-common-tests/intrinsics/biguint64array_sort.ets +++ b/static_core/plugins/ets/tests/ets-common-tests/intrinsics/biguint64array_sort.ets @@ -20,7 +20,7 @@ const SINGLE = [88]; function checkSorted(a: BigUint64Array): void { for (let i = 0; i < ARRAY_SIZE; ++i) { - arktest.assertEQ(a[i].getLong(), SORTED[i] as long); + arktest.assertEQ(a[i].getLong(), SORTED[i].toLong()); } } @@ -32,7 +32,7 @@ function sortEmpty(): void { function sortSingle(): void { let single: BigUint64Array = new BigUint64Array(SINGLE); single.sort(); - arktest.assertEQ(single[0].getLong(), SINGLE[0] as long); + arktest.assertEQ(single[0].getLong(), SINGLE[0].toLong()); } function sortNormal(): void { diff --git a/static_core/plugins/ets/tests/ets-common-tests/intrinsics/int16array_sort.ets b/static_core/plugins/ets/tests/ets-common-tests/intrinsics/int16array_sort.ets index 9293f415b3..95c0afd89e 100644 --- a/static_core/plugins/ets/tests/ets-common-tests/intrinsics/int16array_sort.ets +++ b/static_core/plugins/ets/tests/ets-common-tests/intrinsics/int16array_sort.ets @@ -25,7 +25,7 @@ function fillBuffer(buf: ArrayBuffer): void { arktest.assertEQ(Short.BYTE_SIZE, 2); for (let i = 0; i < AB_SIZE; ++i) { if ((i % Short.BYTE_SIZE) == 0) { - let v: short = UNSORTED[i / 2] as short; + let v: short = UNSORTED[i / 2].toShort(); if (Runtime.isLittleEndianPlatform()) { buf.set(i, v.toByte()); buf.set(i + 1, (v >>> 8).toByte()); diff --git a/static_core/plugins/ets/tests/ets-common-tests/intrinsics/int32array_sort.ets b/static_core/plugins/ets/tests/ets-common-tests/intrinsics/int32array_sort.ets index 1940d81dd4..e68de4e8b6 100644 --- a/static_core/plugins/ets/tests/ets-common-tests/intrinsics/int32array_sort.ets +++ b/static_core/plugins/ets/tests/ets-common-tests/intrinsics/int32array_sort.ets @@ -25,7 +25,7 @@ function fillBuffer(buf: ArrayBuffer): void { arktest.assertEQ(Int.BYTE_SIZE, 4); for (let i = 0; i < AB_SIZE; ++i) { if ((i % Int.BYTE_SIZE) == 0) { - let v: int = UNSORTED[i / Int.BYTE_SIZE] as int; + let v: int = UNSORTED[i / Int.BYTE_SIZE].toInt(); if (Runtime.isLittleEndianPlatform()) { buf.set(i, v.toByte()); buf.set(i + 1, (v >>> 8).toByte()); diff --git a/static_core/plugins/ets/tests/ets-common-tests/intrinsics/isFinite.ets b/static_core/plugins/ets/tests/ets-common-tests/intrinsics/isFinite.ets index 5655e07549..afaa202488 100644 --- a/static_core/plugins/ets/tests/ets-common-tests/intrinsics/isFinite.ets +++ b/static_core/plugins/ets/tests/ets-common-tests/intrinsics/isFinite.ets @@ -29,7 +29,7 @@ function main(): int { if (!Float.isFinite(Float.MIN_VALUE)) { return 5; } - if (!Float.isFinite(1.2345 as float)) { + if (!Float.isFinite(1.2345f)) { return 6; } if (Double.isFinite(Double.NaN)) { diff --git a/static_core/plugins/ets/tests/ets-common-tests/intrinsics/isInteger.ets b/static_core/plugins/ets/tests/ets-common-tests/intrinsics/isInteger.ets index 8df65b15ca..40e433def7 100644 --- a/static_core/plugins/ets/tests/ets-common-tests/intrinsics/isInteger.ets +++ b/static_core/plugins/ets/tests/ets-common-tests/intrinsics/isInteger.ets @@ -26,7 +26,7 @@ class IsIntegerDoubleTest { function main(): int { let ft = new IsIntegerFloatTest(); ft.rightInteger = 1.0f; - ft.wrongInteger = 1.0 as float + Float.DELTA + Float.DELTA; + ft.wrongInteger = 1.0f + Float.DELTA + Float.DELTA; if (Float.isInteger(Float.NaN) != false) { return 1; diff --git a/static_core/plugins/ets/tests/ets-common-tests/intrinsics/isNaN.ets b/static_core/plugins/ets/tests/ets-common-tests/intrinsics/isNaN.ets index 34103d4517..516ad21023 100644 --- a/static_core/plugins/ets/tests/ets-common-tests/intrinsics/isNaN.ets +++ b/static_core/plugins/ets/tests/ets-common-tests/intrinsics/isNaN.ets @@ -29,7 +29,7 @@ function main(): int { if (Float.isNaN(Float.MIN_VALUE)) { return 5; } - if (Float.isNaN(1.2345 as float)) { + if (Float.isNaN(1.2345f)) { return 6; } diff --git a/static_core/plugins/ets/tests/ets-common-tests/intrinsics/isSafeInteger.ets b/static_core/plugins/ets/tests/ets-common-tests/intrinsics/isSafeInteger.ets index f84174f5b0..de8cb6868f 100644 --- a/static_core/plugins/ets/tests/ets-common-tests/intrinsics/isSafeInteger.ets +++ b/static_core/plugins/ets/tests/ets-common-tests/intrinsics/isSafeInteger.ets @@ -26,7 +26,7 @@ class IsIntegerDoubleTest { function main(): int { let ft = new IsIntegerFloatTest(); ft.safeInteger = 1.0f; - ft.unsafeInteger = 1.0 as float + Float.MAX_SAFE_INTEGER; + ft.unsafeInteger = 1.0f + Float.MAX_SAFE_INTEGER; if (Float.isSafeInteger(Float.NaN) != false) { return 1; diff --git a/static_core/plugins/ets/tests/ets-common-tests/intrinsics/max.ets b/static_core/plugins/ets/tests/ets-common-tests/intrinsics/max.ets index 65f996d113..6e9200fc27 100644 --- a/static_core/plugins/ets/tests/ets-common-tests/intrinsics/max.ets +++ b/static_core/plugins/ets/tests/ets-common-tests/intrinsics/max.ets @@ -58,22 +58,22 @@ function main() : int { if (max(Float.MAX_VALUE, Float.NEGATIVE_INFINITY) != Float.MAX_VALUE) { return 22; } - if (max(0.0 as float, Float.NEGATIVE_INFINITY) != 0) { + if (max(0.0f, Float.NEGATIVE_INFINITY) != 0) { return 23; } - if (max(0.0 as float, Float.MIN_VALUE) != Float.MIN_VALUE) { + if (max(0.0f, Float.MIN_VALUE) != Float.MIN_VALUE) { return 24; } if (max(Float.MAX_VALUE, Float.MIN_VALUE) != Float.MAX_VALUE) { return 25; } - if (max(0.0 as float, 2.0 as float) != 2.0 as float) { + if (max(0.0f, 2.0f) != 2.0f) { return 26; } - if (max(0.0 as float, -4.0 as float) != 0.0 as float) { + if (max((0.0).toFloat(), (-4.0).toFloat()) != (0.0).toFloat()) { return 27; } - if (max(1.e-10 as float, 2.e+12 as float) != 2.e+12 as float) { + if (max((1.e-10).toFloat(), (2.e+12).toFloat()) != (2.e+12).toFloat()) { return 28; } diff --git a/static_core/plugins/ets/tests/ets-common-tests/intrinsics/min.ets b/static_core/plugins/ets/tests/ets-common-tests/intrinsics/min.ets index e44eaf6a83..52f0319a13 100644 --- a/static_core/plugins/ets/tests/ets-common-tests/intrinsics/min.ets +++ b/static_core/plugins/ets/tests/ets-common-tests/intrinsics/min.ets @@ -58,22 +58,22 @@ function main() : int { if (min(Float.MAX_VALUE, Float.NEGATIVE_INFINITY) != Float.NEGATIVE_INFINITY) { return 22; } - if (min(0.0 as float, Float.NEGATIVE_INFINITY) != Float.NEGATIVE_INFINITY) { + if (min(0.0f, Float.NEGATIVE_INFINITY) != Float.NEGATIVE_INFINITY) { return 23; } - if (min(0.0 as float, Float.MIN_VALUE) != 0.0 as float) { + if (min(0.0f, Float.MIN_VALUE) != 0.0f) { return 24; } if (min(Float.MAX_VALUE, Float.MIN_VALUE) != Float.MIN_VALUE) { return 25; } - if (min(0.0 as float, 2.0 as float) != 0.0 as float) { + if (min(0.0f, 2.0f) != 0.0f) { return 26; } - if (min(0.0 as float, -4.0 as float) != -4.0 as float) { + if (min((0.0).toFloat(), (-4.0).toFloat()) != (-4.0).toFloat()) { return 27; } - if (min(1.e-10 as float, 2.e+12 as float) != 1.e-10 as float) { + if (min((1.e-10).toFloat(), (2.e+12).toFloat()) != (1.e-10).toFloat()) { return 28; } diff --git a/static_core/plugins/ets/tests/ets-common-tests/intrinsics/to_string_cache.ets b/static_core/plugins/ets/tests/ets-common-tests/intrinsics/to_string_cache.ets index ca10a2e9a8..be411c3773 100644 --- a/static_core/plugins/ets/tests/ets-common-tests/intrinsics/to_string_cache.ets +++ b/static_core/plugins/ets/tests/ets-common-tests/intrinsics/to_string_cache.ets @@ -44,7 +44,7 @@ function parseLong(s: String): long|null { if (!Char.isDecDigit(ch)) { return null; } - let digit = (ch.toInt() - Char.toInt(c'0')) as int; + let digit = (ch.toInt() - Char.toInt(c'0')).toInt(); if (negative) { if (result < (Long.MIN_VALUE + digit) / 10) { return null; @@ -89,8 +89,8 @@ function isEqual(s: String, number: T): boolean { if (Float.isNaN(number)) { return s == 'NaN'; } - let eps: float = Math.abs(number.toFloat()) * 2 * Float.EPSILON as float; - let parsed = Double.parseFloat(s) as float; + let eps: float = (Math.abs(number.toFloat()) * 2 * Float.EPSILON).toFloat(); + let parsed = Double.parseFloat(s).toFloat(); let delta: float = parsed - number.toFloat(); if (Math.abs(delta) > eps) { console.println(`float parsed: ${parsed}, bitCastToInt: ${Float.bitCastToInt(parsed as float)} eps: ${eps} delta: ${delta}`) @@ -114,7 +114,7 @@ class Worker { let numbers = new Array; for (let i = 0; i < iters; i++) { state = xorshift(state); - let randomInt = (state >>> 33) as int; + let randomInt = (state >>> 33).toInt(); let index = randomInt % this.values.length; let value = this.values[index]!; let str = (value as object).toString(); @@ -143,7 +143,7 @@ const iterCount = valueCount * 3; function doTest(values: T[], workers: int) { let jobs = new (Job | undefined)[workers]; for (let i = 0; i < workers; i++) { - let state = (i as long * 1234567) | 42; + let state = (i.toLong() * 1234567) | 42; // check only in one worker to make others faster let check = i == 0; let worker = new Worker(values); @@ -162,7 +162,7 @@ function testDoubles() { // console.println('testDoubles') let values = new Double[valueCount]; for (let i = 0; i < valueCount; i++) { - let exp = (Math.random() * 2 - 1) * 310 as int + let exp = (Math.random() * 2 - 1) * (310).toInt() values[i] = Math.random() * Math.pow(10, exp); } doTest(values, workerCount); @@ -183,8 +183,8 @@ function testFloats() { // console.println('testFloats'); let values = new Float[valueCount]; for (let i = 0; i < valueCount; i++) { - let exp = (Math.random() * 2 - 1) * 39 as int - values[i] = Math.random() * Math.pow(10, exp) as float; + let exp = (Math.random() * 2 - 1) * (39).toInt() + values[i] = (Math.random() * Math.pow(10, exp)).toFloat(); } doTest(values, workerCount); } @@ -195,7 +195,7 @@ function testFloatsBitcast() { let state = 42 as long; for (let i = 0; i < valueCount; i++) { state = xorshift(state); - values[i] = Float.bitCastFromInt(state as int); + values[i] = Float.bitCastFromInt(state.toInt()); } doTest(values, workerCount); } diff --git a/static_core/plugins/ets/tests/ets-templates/03.types/06.value_types/01.numeric_types/hier1.params.yaml b/static_core/plugins/ets/tests/ets-templates/03.types/06.value_types/01.numeric_types/hier1.params.yaml index 526e7fa80b..43a0a74003 100644 --- a/static_core/plugins/ets/tests/ets-templates/03.types/06.value_types/01.numeric_types/hier1.params.yaml +++ b/static_core/plugins/ets/tests/ets-templates/03.types/06.value_types/01.numeric_types/hier1.params.yaml @@ -57,7 +57,7 @@ cases: - { op: '<<=', val: 1280 } - { op: '>>=', val: 0 } - { op: '>>>=', val: 0 } - - lg: 'float = 16.0 as float' + - lg: 'float = 16.0f' sm: 'byte = 4 as byte' ops: - { op: '=', val: 4 } @@ -106,7 +106,7 @@ cases: - { op: '<<=', val: 1280 } - { op: '>>=', val: 0 } - { op: '>>>=', val: 0 } - - lg: 'float = 16.0 as float' + - lg: 'float = 16.0f' sm: 'short = 4 as short' ops: - { op: '=', val: 4 } @@ -140,7 +140,7 @@ cases: - { op: '<<=', val: 1280 } - { op: '>>=', val: 0 } - { op: '>>>=', val: 0 } - - lg: 'float = 16.0 as float' + - lg: 'float = 16.0f' sm: 'int = 4 as int' ops: - { op: '=', val: 4 } @@ -159,7 +159,7 @@ cases: - { op: '/=', val: 4 } - { op: '%=', val: 0 } - - lg: 'float = 16.0 as float' + - lg: 'float = 16.0f' sm: 'long = 4 as long' ops: - { op: '=', val: 4 } @@ -179,7 +179,7 @@ cases: - { op: '%=', val: 0 } - lg: 'double = 16.0 as double' - sm: 'float = 4 as float' + sm: 'float = 4.0f' ops: - { op: '=', val: 4 } - { op: '+=', val: 20 } diff --git a/static_core/plugins/ets/tests/ets-templates/03.types/06.value_types/03.floating-point_types_and_operations/equal/equal_float.params.yaml b/static_core/plugins/ets/tests/ets-templates/03.types/06.value_types/03.floating-point_types_and_operations/equal/equal_float.params.yaml index 0549b606a8..7f3db8e587 100644 --- a/static_core/plugins/ets/tests/ets-templates/03.types/06.value_types/03.floating-point_types_and_operations/equal/equal_float.params.yaml +++ b/static_core/plugins/ets/tests/ets-templates/03.types/06.value_types/03.floating-point_types_and_operations/equal/equal_float.params.yaml @@ -3,7 +3,7 @@ # 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 +# http://www.apache.org/licenses/LICENSE-2.0f # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, diff --git a/static_core/plugins/ets/tests/ets-templates/03.types/06.value_types/03.floating-point_types_and_operations/greater_or_equal/greater_or_equal_float.params.yaml b/static_core/plugins/ets/tests/ets-templates/03.types/06.value_types/03.floating-point_types_and_operations/greater_or_equal/greater_or_equal_float.params.yaml index 7f32c51661..98f925e3c1 100644 --- a/static_core/plugins/ets/tests/ets-templates/03.types/06.value_types/03.floating-point_types_and_operations/greater_or_equal/greater_or_equal_float.params.yaml +++ b/static_core/plugins/ets/tests/ets-templates/03.types/06.value_types/03.floating-point_types_and_operations/greater_or_equal/greater_or_equal_float.params.yaml @@ -1,9 +1,9 @@ # Copyright (c) 2021-2024 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); +# Licensed under the Apache License, Version 2.0f (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 +# http://www.apache.org/licenses/LICENSE-2.0f # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, diff --git a/static_core/plugins/ets/tests/ets-templates/03.types/06.value_types/03.floating-point_types_and_operations/greater_than/greater_than_float.params.yaml b/static_core/plugins/ets/tests/ets-templates/03.types/06.value_types/03.floating-point_types_and_operations/greater_than/greater_than_float.params.yaml index d796a8887b..e200d0fad0 100644 --- a/static_core/plugins/ets/tests/ets-templates/03.types/06.value_types/03.floating-point_types_and_operations/greater_than/greater_than_float.params.yaml +++ b/static_core/plugins/ets/tests/ets-templates/03.types/06.value_types/03.floating-point_types_and_operations/greater_than/greater_than_float.params.yaml @@ -1,9 +1,9 @@ # Copyright (c) 2021-2024 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); +# Licensed under the Apache License, Version 2.0f (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 +# http://www.apache.org/licenses/LICENSE-2.0f # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, diff --git a/static_core/plugins/ets/tests/ets-templates/03.types/06.value_types/03.floating-point_types_and_operations/less_or_equal/less_or_equal_float.params.yaml b/static_core/plugins/ets/tests/ets-templates/03.types/06.value_types/03.floating-point_types_and_operations/less_or_equal/less_or_equal_float.params.yaml index 315dbc5e7d..e1d033247c 100644 --- a/static_core/plugins/ets/tests/ets-templates/03.types/06.value_types/03.floating-point_types_and_operations/less_or_equal/less_or_equal_float.params.yaml +++ b/static_core/plugins/ets/tests/ets-templates/03.types/06.value_types/03.floating-point_types_and_operations/less_or_equal/less_or_equal_float.params.yaml @@ -3,7 +3,7 @@ # 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 +# http://www.apache.org/licenses/LICENSE-2.0f # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, diff --git a/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/04.accessible/type_name_class_field.ets b/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/04.accessible/type_name_class_field.ets index 63c018c8ef..168ef6f97c 100644 --- a/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/04.accessible/type_name_class_field.ets +++ b/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/04.accessible/type_name_class_field.ets @@ -27,7 +27,7 @@ desc: >- {{c.decl}} class A { - {{c.field}} + {{c.field|indent}} bar(i: T): T { return i; } diff --git a/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/07.function_declarations/04.optional_parameters/opt_param.params.yaml b/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/07.function_declarations/04.optional_parameters/opt_param.params.yaml index a05220a6da..fc7df5767e 100644 --- a/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/07.function_declarations/04.optional_parameters/opt_param.params.yaml +++ b/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/07.function_declarations/04.optional_parameters/opt_param.params.yaml @@ -25,7 +25,7 @@ cases: - decl: |- // check primitive defaults - function foo(a: byte = 1, b: short = 2, c: int = 3, d: long = 4, e: float = 5.0, f: double = 6.0, g: boolean = true, h: char = c'W') { + function foo(a: byte = 1, b: short = 2, c: int = 3, d: long = 4, e: float = 5.0f, f: double = 6.0, g: boolean = true, h: char = c'W') { arktest.assertEQ( a, 1 ) arktest.assertEQ( b, 2 ) arktest.assertEQ( c, 3 ) diff --git a/static_core/plugins/ets/tests/ets-templates/05.generics/01.type_parameters/01.type_parameter_constraint/generic_functions/generic_function_constraint.params.yaml b/static_core/plugins/ets/tests/ets-templates/05.generics/01.type_parameters/01.type_parameter_constraint/generic_functions/generic_function_constraint.params.yaml index fa65e2b08b..5da372bca4 100644 --- a/static_core/plugins/ets/tests/ets-templates/05.generics/01.type_parameters/01.type_parameter_constraint/generic_functions/generic_function_constraint.params.yaml +++ b/static_core/plugins/ets/tests/ets-templates/05.generics/01.type_parameters/01.type_parameter_constraint/generic_functions/generic_function_constraint.params.yaml @@ -36,7 +36,7 @@ constraints: p: 1 as long - type: float use: float - p: 1.1.toFloat() + p: 1.1f - type: double use: double p: 1.2 as double diff --git a/static_core/plugins/ets/tests/ets-templates/05.generics/01.type_parameters/01.type_parameter_constraint/generic_methods/generic_method_with_body_constraint.params.yaml b/static_core/plugins/ets/tests/ets-templates/05.generics/01.type_parameters/01.type_parameter_constraint/generic_methods/generic_method_with_body_constraint.params.yaml index 2757a091b1..311a55b18e 100644 --- a/static_core/plugins/ets/tests/ets-templates/05.generics/01.type_parameters/01.type_parameter_constraint/generic_methods/generic_method_with_body_constraint.params.yaml +++ b/static_core/plugins/ets/tests/ets-templates/05.generics/01.type_parameters/01.type_parameter_constraint/generic_methods/generic_method_with_body_constraint.params.yaml @@ -50,8 +50,8 @@ constraints: expected: 1 as long - type: float use: float - p: 1.1.toFloat() - expected: 1.1.toFloat() + p: 1.1f + expected: 1.1f - type: double use: double p: 1.2 as double diff --git a/static_core/plugins/ets/tests/ets-templates/06.contexts_and_conversions/05.implicit_conversions/01.widening_numeric_conversions/decl_const/decl-const-n.params.yaml b/static_core/plugins/ets/tests/ets-templates/06.contexts_and_conversions/05.implicit_conversions/01.widening_numeric_conversions/decl_const/decl-const-n.params.yaml index 24e5c77a82..b8697c1124 100644 --- a/static_core/plugins/ets/tests/ets-templates/06.contexts_and_conversions/05.implicit_conversions/01.widening_numeric_conversions/decl_const/decl-const-n.params.yaml +++ b/static_core/plugins/ets/tests/ets-templates/06.contexts_and_conversions/05.implicit_conversions/01.widening_numeric_conversions/decl_const/decl-const-n.params.yaml @@ -36,10 +36,10 @@ cases: - { from_type: long, expr: 0 as long, to_type: Color } # from float - - { from_type: float, expr: +0.0.toFloat(), to_type: byte } - - { from_type: float, expr: +0.0.toFloat(), to_type: short } - - { from_type: float, expr: +0.0.toFloat(), to_type: int } - - { from_type: float, expr: +0.0.toFloat(), to_type: long } - - { from_type: float, expr: +0.0.toFloat(), to_type: boolean } - - { from_type: float, expr: +0.0.toFloat(), to_type: Color } + - { from_type: float, expr: +0.0f, to_type: byte } + - { from_type: float, expr: +0.0f, to_type: short } + - { from_type: float, expr: +0.0f, to_type: int } + - { from_type: float, expr: +0.0f, to_type: long } + - { from_type: float, expr: +0.0f, to_type: boolean } + - { from_type: float, expr: +0.0f, to_type: Color } diff --git a/static_core/plugins/ets/tests/ets-templates/06.contexts_and_conversions/05.implicit_conversions/01.widening_numeric_conversions/decl_var/decl-var-n.params.yaml b/static_core/plugins/ets/tests/ets-templates/06.contexts_and_conversions/05.implicit_conversions/01.widening_numeric_conversions/decl_var/decl-var-n.params.yaml index 24e5c77a82..b8697c1124 100644 --- a/static_core/plugins/ets/tests/ets-templates/06.contexts_and_conversions/05.implicit_conversions/01.widening_numeric_conversions/decl_var/decl-var-n.params.yaml +++ b/static_core/plugins/ets/tests/ets-templates/06.contexts_and_conversions/05.implicit_conversions/01.widening_numeric_conversions/decl_var/decl-var-n.params.yaml @@ -36,10 +36,10 @@ cases: - { from_type: long, expr: 0 as long, to_type: Color } # from float - - { from_type: float, expr: +0.0.toFloat(), to_type: byte } - - { from_type: float, expr: +0.0.toFloat(), to_type: short } - - { from_type: float, expr: +0.0.toFloat(), to_type: int } - - { from_type: float, expr: +0.0.toFloat(), to_type: long } - - { from_type: float, expr: +0.0.toFloat(), to_type: boolean } - - { from_type: float, expr: +0.0.toFloat(), to_type: Color } + - { from_type: float, expr: +0.0f, to_type: byte } + - { from_type: float, expr: +0.0f, to_type: short } + - { from_type: float, expr: +0.0f, to_type: int } + - { from_type: float, expr: +0.0f, to_type: long } + - { from_type: float, expr: +0.0f, to_type: boolean } + - { from_type: float, expr: +0.0f, to_type: Color } diff --git a/static_core/plugins/ets/tests/ets-templates/07.expressions/04.array_literal/02.type_inference_from_types_of_elements/arr_inf2_num2.params.yaml b/static_core/plugins/ets/tests/ets-templates/07.expressions/04.array_literal/02.type_inference_from_types_of_elements/arr_inf2_num2.params.yaml index f679c762ee..e172d3d89e 100644 --- a/static_core/plugins/ets/tests/ets-templates/07.expressions/04.array_literal/02.type_inference_from_types_of_elements/arr_inf2_num2.params.yaml +++ b/static_core/plugins/ets/tests/ets-templates/07.expressions/04.array_literal/02.type_inference_from_types_of_elements/arr_inf2_num2.params.yaml @@ -22,12 +22,12 @@ cases: - val: '[[0.0f, 2.0]]' # primitives - - { val: '[[0b1.toByte()]]', type: byte } - - { val: '[[0xF.toShort()]]', type: short} - - { val: '[[0o7.toInt()]]', type: int } - - { val: '[[new Long(-9223372036854775807)]]', type: long } - - { val: '[[111e11.toFloat()]]', type: float } - - { val: '[[222e22.toDouble()]]', type: number } + - { val: '[[0b1 as byte]]', type: byte } + - { val: '[[0xF as short]]', type: short} + - { val: '[[0o7 as int]]', type: int } + - { val: '[[-9223372036854775807 as long]]', type: long } + - { val: '[[(111e11).toFloat()]]', type: float } + - { val: '[[222e22 as double]]', type: number } - { val: '[[11111111111n]]', type: BigInt } # boxed diff --git a/static_core/plugins/ets/tests/ets-templates/07.expressions/25.equality_expressions/bigint_equality_operators/eq.params.yaml b/static_core/plugins/ets/tests/ets-templates/07.expressions/25.equality_expressions/bigint_equality_operators/eq.params.yaml index a0a9768818..d7ee835205 100644 --- a/static_core/plugins/ets/tests/ets-templates/07.expressions/25.equality_expressions/bigint_equality_operators/eq.params.yaml +++ b/static_core/plugins/ets/tests/ets-templates/07.expressions/25.equality_expressions/bigint_equality_operators/eq.params.yaml @@ -99,7 +99,7 @@ cases: - new BigInt(9007199254.740991e6) - values: - new BigInt(9007199254.740991e6) - - new BigInt(9007199254740991 as long) + - new BigInt((9007199254740991).toLong()) - values: - 9007199254740990n # max safe integer in double - 1 - new BigInt(new BigInt(9007199254740990.0)) @@ -117,7 +117,7 @@ cases: - new BigInt(-0.9007199254740989e16) - values: - new BigInt(-0.9007199254740989e16) - - new BigInt(-9007199254740989 as long) + - new BigInt((-9007199254740989).toLong()) # from bigint - values: - 94876543875610289630n diff --git a/static_core/plugins/ets/tests/ets-templates/07.expressions/25.equality_expressions/bigint_equality_operators/ne1.params.yaml b/static_core/plugins/ets/tests/ets-templates/07.expressions/25.equality_expressions/bigint_equality_operators/ne1.params.yaml index a0a9768818..d7ee835205 100644 --- a/static_core/plugins/ets/tests/ets-templates/07.expressions/25.equality_expressions/bigint_equality_operators/ne1.params.yaml +++ b/static_core/plugins/ets/tests/ets-templates/07.expressions/25.equality_expressions/bigint_equality_operators/ne1.params.yaml @@ -99,7 +99,7 @@ cases: - new BigInt(9007199254.740991e6) - values: - new BigInt(9007199254.740991e6) - - new BigInt(9007199254740991 as long) + - new BigInt((9007199254740991).toLong()) - values: - 9007199254740990n # max safe integer in double - 1 - new BigInt(new BigInt(9007199254740990.0)) @@ -117,7 +117,7 @@ cases: - new BigInt(-0.9007199254740989e16) - values: - new BigInt(-0.9007199254740989e16) - - new BigInt(-9007199254740989 as long) + - new BigInt((-9007199254740989).toLong()) # from bigint - values: - 94876543875610289630n diff --git a/static_core/plugins/ets/tests/ets-templates/07.expressions/25.equality_expressions/bigint_equality_operators/ne2.params.yaml b/static_core/plugins/ets/tests/ets-templates/07.expressions/25.equality_expressions/bigint_equality_operators/ne2.params.yaml index a0a9768818..d7ee835205 100644 --- a/static_core/plugins/ets/tests/ets-templates/07.expressions/25.equality_expressions/bigint_equality_operators/ne2.params.yaml +++ b/static_core/plugins/ets/tests/ets-templates/07.expressions/25.equality_expressions/bigint_equality_operators/ne2.params.yaml @@ -99,7 +99,7 @@ cases: - new BigInt(9007199254.740991e6) - values: - new BigInt(9007199254.740991e6) - - new BigInt(9007199254740991 as long) + - new BigInt((9007199254740991).toLong()) - values: - 9007199254740990n # max safe integer in double - 1 - new BigInt(new BigInt(9007199254740990.0)) @@ -117,7 +117,7 @@ cases: - new BigInt(-0.9007199254740989e16) - values: - new BigInt(-0.9007199254740989e16) - - new BigInt(-9007199254740989 as long) + - new BigInt((-9007199254740989).toLong()) # from bigint - values: - 94876543875610289630n diff --git a/static_core/plugins/ets/tests/ets-templates/07.expressions/31.string_interpolation_expressions/siexp.params.yaml b/static_core/plugins/ets/tests/ets-templates/07.expressions/31.string_interpolation_expressions/siexp.params.yaml index 8c47cbe33d..1550561a1f 100644 --- a/static_core/plugins/ets/tests/ets-templates/07.expressions/31.string_interpolation_expressions/siexp.params.yaml +++ b/static_core/plugins/ets/tests/ets-templates/07.expressions/31.string_interpolation_expressions/siexp.params.yaml @@ -14,19 +14,19 @@ cases: - use: |- const b1: byte = Byte.MIN_VALUE - const b2: byte = 0 as byte + const b2: byte = (0).toByte() const b3: byte = Byte.MAX_VALUE const s1: short = Short.MIN_VALUE - const s2: short = 0 as short + const s2: short = (0).toShort() const s3: short = Short.MAX_VALUE const i1: int = Int.MIN_VALUE - const i2: int = 0 as int + const i2: int = (0).toInt() const i3: int = Int.MAX_VALUE const l1: long = Long.MIN_VALUE - const l2: long = 0 as long + const l2: long = (0).toLong() const l3: long = Long.MAX_VALUE const f1: float = Float.MIN_VALUE - const f2: float = 0.0.toFloat() + const f2: float = 0.0f const f3: float = Float.MAX_VALUE const n1: number = Number.MIN_VALUE const n2: number = 0.0 @@ -37,19 +37,19 @@ cases: - use: |- const b1: Byte = Byte.MIN_VALUE - const b2: Byte = 0 as byte + const b2: Byte = (0).toByte() const b3: Byte = Byte.MAX_VALUE const s1: Short = Short.MIN_VALUE - const s2: Short = 0 as short + const s2: Short = (0).toShort() const s3: Short = Short.MAX_VALUE const i1: Int = Int.MIN_VALUE - const i2: Int = 0 as int + const i2: Int = (0).toInt() const i3: Int = Int.MAX_VALUE const l1: Long = Long.MIN_VALUE - const l2: Long = 0 as long + const l2: Long = (0).toLong() const l3: Long = Long.MAX_VALUE const f1: Float = Float.MIN_VALUE - const f2: Float = 0.0.toFloat() + const f2: Float = 0.0f const f3: Float = Float.MAX_VALUE const n1: Number = Number.MIN_VALUE const n2: Number = 0.0 diff --git a/static_core/plugins/ets/tests/ets-templates/07.expressions/33.constant_expression/check_array/constant_bitwise_expression.params.yaml b/static_core/plugins/ets/tests/ets-templates/07.expressions/33.constant_expression/check_array/constant_bitwise_expression.params.yaml index f7570ed796..9af9317f65 100644 --- a/static_core/plugins/ets/tests/ets-templates/07.expressions/33.constant_expression/check_array/constant_bitwise_expression.params.yaml +++ b/static_core/plugins/ets/tests/ets-templates/07.expressions/33.constant_expression/check_array/constant_bitwise_expression.params.yaml @@ -22,10 +22,10 @@ cases: - { type: int, value: 10, expression: '& 7', expected: 2 } - { type: int, value: 10, expression: '| 7', expected: 15 } - - { type: int, value: 10, expression: '^ 7', expected: 13 } + - { type: int, value: (10).toInt(), expression: '^ 7', expected: 13 } - - { type: long, value: 10, expression: '& 7', expected: 2 } - - { type: long, value: 10, expression: '| 7', expected: 15 } + - { type: long, value: (10).toLong(), expression: '& 7', expected: 2 } + - { type: long, value: (10).toLong(), expression: '| 7', expected: 15 } - { type: long, value: 10, expression: '^ 7', expected: 13 } - { type: float, value: 10.5f, expression: '& 7.0f', expected: 2 } diff --git a/static_core/plugins/ets/tests/ets-templates/07.expressions/33.constant_expression/check_array/constant_logical_expression.params.yaml b/static_core/plugins/ets/tests/ets-templates/07.expressions/33.constant_expression/check_array/constant_logical_expression.params.yaml index 6d0d12c256..c84ce4b70b 100644 --- a/static_core/plugins/ets/tests/ets-templates/07.expressions/33.constant_expression/check_array/constant_logical_expression.params.yaml +++ b/static_core/plugins/ets/tests/ets-templates/07.expressions/33.constant_expression/check_array/constant_logical_expression.params.yaml @@ -12,19 +12,19 @@ # limitations under the License. --- cases: - - { type: byte, value: 10, expression: '< 12', expected: 10 } - - { type: byte, value: 10, expression: '< 12.0f', expected: 10 } - - { type: short, value: 10, expression: '< 12', expected: 10 } - - { type: short, value: 10, expression: '< 12.0f', expected: 10 } - + - { type: byte, value: (10).toByte(), expression: '< 12', expected: 10 } + - { type: byte, value: (10).toByte(), expression: '< 12.0f', expected: 10 } + - { type: short, value: (10).toByte(), expression: '< 12', expected: 10 } + - { type: short, value: (10).toByte(), expression: '< 12.0f', expected: 10 } + - { type: short, value: 260, expression: '<= 25', expected: 285 } - { type: int, value: 30, expression: '>= -30', expected: 30 } - - { type: long, value: 260, expression: '== 259', expected: 285 } + - { type: long, value: (260).toLong(), expression: '== 259', expected: 285 } - { type: float, value: 26.0f, expression: '== 26.0f', expected: 26 } - { type: number, value: 27.0, expression: '== 27', expected: 27 } - { type: number, value: 28.3, expression: '== 28.3', expected: 28 } - { type: float, value: 21.7f, expression: '== 21.7f', expected: 21 } - - { type: number, value: 22.3, expression: '== 22.3', expected: 22 } + - { type: number, value: 22.3f, expression: '== 22.3f', expected: 22 } - { type: char, value: c'p', expression: '== 112', expected: 112 } - { type: char, value: c'p', expression: '> 100', expected: 112 } diff --git a/static_core/plugins/ets/tests/ets-templates/07.expressions/33.constant_expression/check_array/constant_shift.params.yaml b/static_core/plugins/ets/tests/ets-templates/07.expressions/33.constant_expression/check_array/constant_shift.params.yaml index 928ecdf165..9a4f68ab74 100644 --- a/static_core/plugins/ets/tests/ets-templates/07.expressions/33.constant_expression/check_array/constant_shift.params.yaml +++ b/static_core/plugins/ets/tests/ets-templates/07.expressions/33.constant_expression/check_array/constant_shift.params.yaml @@ -24,9 +24,9 @@ cases: - { type: int, value: 38, sign: '>>', expected: 4 } - { type: int, value: 38, sign: '>>>', expected: 4 } - - { type: long, value: 46, sign: '<<', expected: 368 } - - { type: long, value: 46, sign: '>>', expected: 5 } - - { type: long, value: 46, sign: '>>>', expected: 5 } + - { type: long, value: (46).toLong(), sign: '<<', expected: 368 } + - { type: long, value: (46).toLong(), sign: '>>', expected: 5 } + - { type: long, value: (46).toLong(), sign: '>>>', expected: 5 } - { type: float, value: 53.2f, sign: '<<', expected: 424 } - { type: float, value: 53.2f, sign: '>>', expected: 6 } diff --git a/static_core/plugins/ets/tests/ets-templates/15.semantic_rules/10.overloading/single_class_overload_n.params.yaml b/static_core/plugins/ets/tests/ets-templates/15.semantic_rules/10.overloading/single_class_overload_n.params.yaml index 6e78d1d449..7cc68d7f77 100644 --- a/static_core/plugins/ets/tests/ets-templates/15.semantic_rules/10.overloading/single_class_overload_n.params.yaml +++ b/static_core/plugins/ets/tests/ets-templates/15.semantic_rules/10.overloading/single_class_overload_n.params.yaml @@ -34,31 +34,31 @@ cases: new Base(); arktest.assertEQ( res, 1); - new Base(1 as short); + new Base((1).toShort()); arktest.assertEQ( res, 2); new Base(new Short()); arktest.assertEQ( res, 2); - new Base(1 as int); + new Base((1).toInt()); arktest.assertEQ( res, 4); new Base(new Int()); arktest.assertEQ( res, 4); - new Base(1 as long); + new Base((1).toLong()); arktest.assertEQ( res, 6); new Base(new Long()); arktest.assertEQ( res, 6); - new Base(1.1.toFloat()); + new Base((1.1).toFloat()); arktest.assertEQ( res, 8); new Base(new Float()); arktest.assertEQ( res, 8); - new Base(1.2 as double); + new Base(1.2); arktest.assertEQ( res, 10); new Base(new Number()); @@ -73,7 +73,7 @@ cases: new Base("some str"); arktest.assertEQ( res, 14); - new Base(1 as byte); + new Base((1).toByte()); arktest.assertEQ( res, 15); new Base(new Byte()); @@ -85,7 +85,7 @@ cases: new Base(new Boolean()); arktest.assertEQ( res, 17); - new Base(1 as int, 1 as int); + new Base((1).toInt(), (1).toInt()); arktest.assertEQ( res, 19); new Base(new Gen()); @@ -103,7 +103,7 @@ cases: new Base(1.1 as number, new Number()); arktest.assertEQ( res, 23); - new Base(new Number(), 1.1 as number); + new Base(new Number(), 1.1); arktest.assertEQ( res, 23); - tags: negative, compile-only @@ -152,31 +152,31 @@ cases: a.foo(); arktest.assertEQ( res, 1); - a.foo(1 as short); + a.foo((1).toShort()); arktest.assertEQ( res, 2); a.foo(new Short()); arktest.assertEQ( res, 2); - a.foo(1 as int); + a.foo((1).toInt()); arktest.assertEQ( res, 4); a.foo(new Int()); arktest.assertEQ( res, 4); - a.foo(1 as long); + a.foo((1).toLong()); arktest.assertEQ( res, 6); a.foo(new Long()); arktest.assertEQ( res, 6); - a.foo(1.1.toFloat()); + a.foo((1.1).toFloat()); arktest.assertEQ( res, 8); a.foo(new Float()); arktest.assertEQ( res, 8); - a.foo(1.2 as double); + a.foo(1.2); arktest.assertEQ( res, 10); a.foo(new Number()); @@ -191,7 +191,7 @@ cases: a.foo("some str"); arktest.assertEQ( res, 14); - a.foo(1 as byte); + a.foo((1).toByte()); arktest.assertEQ( res, 15); a.foo(new Byte()); @@ -203,7 +203,7 @@ cases: a.foo(new Boolean()); arktest.assertEQ( res, 17); - a.foo(1 as int, 1 as int); + a.foo((1).toInt(), (1).toInt()); arktest.assertEQ( res, 19); a.foo(new Gen()); @@ -269,31 +269,31 @@ cases: Base.foo(); arktest.assertEQ( res, 1); - Base.foo(1 as short); + Base.foo((1).toShort()); arktest.assertEQ( res, 2); Base.foo(new Short()); arktest.assertEQ( res, 2); - Base.foo(1 as int); + Base.foo((1).toInt()); arktest.assertEQ( res, 4); Base.foo(new Int()); arktest.assertEQ( res, 4); - Base.foo(1 as long); + Base.foo((1).toLong()); arktest.assertEQ( res, 6); Base.foo(new Long()); arktest.assertEQ( res, 6); - Base.foo(1.1.toFloat()); + Base.foo((1.1).toFloat()); arktest.assertEQ( res, 8); Base.foo(new Float()); arktest.assertEQ( res, 8); - Base.foo(1.2 as double); + Base.foo(1.2); arktest.assertEQ( res, 10); Base.foo(new Number()); @@ -308,7 +308,7 @@ cases: Base.foo("some str"); arktest.assertEQ( res, 14); - Base.foo(1 as byte); + Base.foo((1).toByte()); arktest.assertEQ( res, 15); Base.foo(new Byte()); @@ -320,7 +320,7 @@ cases: Base.foo(new Boolean()); arktest.assertEQ( res, 17); - Base.foo(1 as int, 1 as int); + Base.foo((1).toInt(), (1).toInt()); arktest.assertEQ( res, 19); Base.foo(undefined); diff --git a/static_core/plugins/ets/tests/ets-templates/15.semantic_rules/14.compatibility_features/01.extended_conditional_expressions/cond_t1.params.yaml b/static_core/plugins/ets/tests/ets-templates/15.semantic_rules/14.compatibility_features/01.extended_conditional_expressions/cond_t1.params.yaml index 150aa8f160..44ca0e6137 100644 --- a/static_core/plugins/ets/tests/ets-templates/15.semantic_rules/14.compatibility_features/01.extended_conditional_expressions/cond_t1.params.yaml +++ b/static_core/plugins/ets/tests/ets-templates/15.semantic_rules/14.compatibility_features/01.extended_conditional_expressions/cond_t1.params.yaml @@ -50,7 +50,7 @@ cases: - new Byte(11) - new Short(1111) - new Int(111111) - - new Float(11111111.0) + - new Float(11111111.0f) - new Double(1111111111.0) - new Number(1e33 as number) diff --git a/static_core/plugins/ets/tests/ets-templates/15.semantic_rules/14.compatibility_features/01.extended_conditional_expressions/cond_t2.params.yaml b/static_core/plugins/ets/tests/ets-templates/15.semantic_rules/14.compatibility_features/01.extended_conditional_expressions/cond_t2.params.yaml index 75e7f29453..43245b4b45 100644 --- a/static_core/plugins/ets/tests/ets-templates/15.semantic_rules/14.compatibility_features/01.extended_conditional_expressions/cond_t2.params.yaml +++ b/static_core/plugins/ets/tests/ets-templates/15.semantic_rules/14.compatibility_features/01.extended_conditional_expressions/cond_t2.params.yaml @@ -13,8 +13,8 @@ --- # truthy values cases: - - { val: '0x80.toByte()', type: 'byte' } - - { val: '0x8000.toShort()', type: 'short' } + - { val: '(0x80).toByte()', type: 'byte' } + - { val: '(0x8000).toShort()', type: 'short' } - { val: '0x80000000', type: 'int' } - { val: '0x8000000000000000.toLong()', type: 'long' } - { val: '0.000001f', type: 'float' } diff --git a/static_core/plugins/ets/tests/ets-templates/15.semantic_rules/14.compatibility_features/01.extended_conditional_expressions/do_t.params.yaml b/static_core/plugins/ets/tests/ets-templates/15.semantic_rules/14.compatibility_features/01.extended_conditional_expressions/do_t.params.yaml index 75e7f29453..43245b4b45 100644 --- a/static_core/plugins/ets/tests/ets-templates/15.semantic_rules/14.compatibility_features/01.extended_conditional_expressions/do_t.params.yaml +++ b/static_core/plugins/ets/tests/ets-templates/15.semantic_rules/14.compatibility_features/01.extended_conditional_expressions/do_t.params.yaml @@ -13,8 +13,8 @@ --- # truthy values cases: - - { val: '0x80.toByte()', type: 'byte' } - - { val: '0x8000.toShort()', type: 'short' } + - { val: '(0x80).toByte()', type: 'byte' } + - { val: '(0x8000).toShort()', type: 'short' } - { val: '0x80000000', type: 'int' } - { val: '0x8000000000000000.toLong()', type: 'long' } - { val: '0.000001f', type: 'float' } diff --git a/static_core/plugins/ets/tests/ets-templates/15.semantic_rules/14.compatibility_features/01.extended_conditional_expressions/for_t.params.yaml b/static_core/plugins/ets/tests/ets-templates/15.semantic_rules/14.compatibility_features/01.extended_conditional_expressions/for_t.params.yaml index 75e7f29453..43245b4b45 100644 --- a/static_core/plugins/ets/tests/ets-templates/15.semantic_rules/14.compatibility_features/01.extended_conditional_expressions/for_t.params.yaml +++ b/static_core/plugins/ets/tests/ets-templates/15.semantic_rules/14.compatibility_features/01.extended_conditional_expressions/for_t.params.yaml @@ -13,8 +13,8 @@ --- # truthy values cases: - - { val: '0x80.toByte()', type: 'byte' } - - { val: '0x8000.toShort()', type: 'short' } + - { val: '(0x80).toByte()', type: 'byte' } + - { val: '(0x8000).toShort()', type: 'short' } - { val: '0x80000000', type: 'int' } - { val: '0x8000000000000000.toLong()', type: 'long' } - { val: '0.000001f', type: 'float' } diff --git a/static_core/plugins/ets/tests/ets-templates/15.semantic_rules/14.compatibility_features/01.extended_conditional_expressions/if_t1.params.yaml b/static_core/plugins/ets/tests/ets-templates/15.semantic_rules/14.compatibility_features/01.extended_conditional_expressions/if_t1.params.yaml index 57e71f9a80..fdb00c9785 100644 --- a/static_core/plugins/ets/tests/ets-templates/15.semantic_rules/14.compatibility_features/01.extended_conditional_expressions/if_t1.params.yaml +++ b/static_core/plugins/ets/tests/ets-templates/15.semantic_rules/14.compatibility_features/01.extended_conditional_expressions/if_t1.params.yaml @@ -18,7 +18,7 @@ cases: - '0x7FFF.toShort()' - '0x7FFFFFFF.toInt()' - '0x7FFFFFFFFFFFFFFF as long' - - '0.0001.toFloat()' + - '(0.0001).toFloat()' - '1e22.toDouble()' - '0.0000001 as number' @@ -50,7 +50,7 @@ cases: - new Byte(11).unboxed() - new Short(1111).unboxed() - new Int(111111).unboxed() - - new Float(11111111.0).unboxed() + - new Float(11111111.0f).unboxed() - new Double(1111111111.0).unboxed() - new Number(1e33 as number).unboxed() diff --git a/static_core/plugins/ets/tests/ets-templates/15.semantic_rules/14.compatibility_features/01.extended_conditional_expressions/if_t2.params.yaml b/static_core/plugins/ets/tests/ets-templates/15.semantic_rules/14.compatibility_features/01.extended_conditional_expressions/if_t2.params.yaml index 75e7f29453..43245b4b45 100644 --- a/static_core/plugins/ets/tests/ets-templates/15.semantic_rules/14.compatibility_features/01.extended_conditional_expressions/if_t2.params.yaml +++ b/static_core/plugins/ets/tests/ets-templates/15.semantic_rules/14.compatibility_features/01.extended_conditional_expressions/if_t2.params.yaml @@ -13,8 +13,8 @@ --- # truthy values cases: - - { val: '0x80.toByte()', type: 'byte' } - - { val: '0x8000.toShort()', type: 'short' } + - { val: '(0x80).toByte()', type: 'byte' } + - { val: '(0x8000).toShort()', type: 'short' } - { val: '0x80000000', type: 'int' } - { val: '0x8000000000000000.toLong()', type: 'long' } - { val: '0.000001f', type: 'float' } diff --git a/static_core/plugins/ets/tests/ets-templates/15.semantic_rules/14.compatibility_features/01.extended_conditional_expressions/while_t.params.yaml b/static_core/plugins/ets/tests/ets-templates/15.semantic_rules/14.compatibility_features/01.extended_conditional_expressions/while_t.params.yaml index 75e7f29453..43245b4b45 100644 --- a/static_core/plugins/ets/tests/ets-templates/15.semantic_rules/14.compatibility_features/01.extended_conditional_expressions/while_t.params.yaml +++ b/static_core/plugins/ets/tests/ets-templates/15.semantic_rules/14.compatibility_features/01.extended_conditional_expressions/while_t.params.yaml @@ -13,8 +13,8 @@ --- # truthy values cases: - - { val: '0x80.toByte()', type: 'byte' } - - { val: '0x8000.toShort()', type: 'short' } + - { val: '(0x80).toByte()', type: 'byte' } + - { val: '(0x8000).toShort()', type: 'short' } - { val: '0x80000000', type: 'int' } - { val: '0x8000000000000000.toLong()', type: 'long' } - { val: '0.000001f', type: 'float' } diff --git a/static_core/plugins/ets/tests/ets-templates/17.experimental_features/02.fixed_array_types/far1.params.yaml b/static_core/plugins/ets/tests/ets-templates/17.experimental_features/02.fixed_array_types/far1.params.yaml index af976fee3e..0d15819275 100644 --- a/static_core/plugins/ets/tests/ets-templates/17.experimental_features/02.fixed_array_types/far1.params.yaml +++ b/static_core/plugins/ets/tests/ets-templates/17.experimental_features/02.fixed_array_types/far1.params.yaml @@ -16,7 +16,7 @@ cases: - decl: |- let x: FixedArray use: |- - x = [0x80.toByte(), 0x7f.toByte()] + x = [(0x80).toByte(), (0x7f).toByte()] let obj: Object = toObj(x) let arr = obj as FixedArray let v: byte = arr[0] @@ -26,7 +26,7 @@ cases: - decl: |- let x: FixedArray use: |- - x = [0x8000.toShort(), 0x7fff.toShort()] + x = [(0x8000).toShort(), (0x7fff).toShort()] let obj: Object = toObj(x) let arr = obj as FixedArray let v: short = arr[0] diff --git a/static_core/plugins/ets/tests/ets-templates/17.experimental_features/02.fixed_array_types/far2.params.yaml b/static_core/plugins/ets/tests/ets-templates/17.experimental_features/02.fixed_array_types/far2.params.yaml index eb5aceb483..eec86bdb5e 100644 --- a/static_core/plugins/ets/tests/ets-templates/17.experimental_features/02.fixed_array_types/far2.params.yaml +++ b/static_core/plugins/ets/tests/ets-templates/17.experimental_features/02.fixed_array_types/far2.params.yaml @@ -25,10 +25,10 @@ types: cases: - type: byte - vals: '0x80.toByte(), 0x7f.toByte()' + vals: '(0x80).toByte(), (0x7f).toByte()' - type: short - vals: '0x8000.toShort(), 0x7fff.toShort()' + vals: '(0x8000).toShort(), (0x7fff).toShort()' - type: int vals: '0x80000000, 0x7fffffff' diff --git a/static_core/plugins/ets/tests/ets-templates/17.experimental_features/09.overload_declarations/02.class_method_overload_declarations/cm_over1.params.yaml b/static_core/plugins/ets/tests/ets-templates/17.experimental_features/09.overload_declarations/02.class_method_overload_declarations/cm_over1.params.yaml index 9444c6d056..4a8495966f 100644 --- a/static_core/plugins/ets/tests/ets-templates/17.experimental_features/09.overload_declarations/02.class_method_overload_declarations/cm_over1.params.yaml +++ b/static_core/plugins/ets/tests/ets-templates/17.experimental_features/09.overload_declarations/02.class_method_overload_declarations/cm_over1.params.yaml @@ -57,16 +57,16 @@ cases: use: |- let a: A = new A() arktest.assertEQ( a.meth(new Byte(-1 as byte)), "byte" ) - arktest.assertEQ( a.meth(new Short(-1 as short)), "short" ) - arktest.assertEQ( a.meth(new Int(-1 as int)), "int" ) - arktest.assertEQ( a.meth(new Long(-1 as long)), "long" ) + arktest.assertEQ( a.meth(new Short((-1)).toShort()), "short" ) + arktest.assertEQ( a.meth(new Int((-1).toInt())), "int" ) + arktest.assertEQ( a.meth(new Long((-1).toLong())), "long" ) arktest.assertEQ( a.meth(new Char(c'A')), "char" ) arktest.assertEQ( a.meth(new Boolean(false)), "boolean" ) arktest.assertEQ( a.meth(new Float(3.14.toFloat())), "float" ) arktest.assertEQ( a.meth(new Double(3.14)), "double" ) - arktest.assertEQ( a.meth(-1 as long), "long" ) - arktest.assertEQ( a.meth(-1 as int), "int" ) - arktest.assertEQ( a.meth(-1 as short), "short" ) + arktest.assertEQ( a.meth((-1).toLong()), "long" ) + arktest.assertEQ( a.meth((-1).toInt()), "int" ) + arktest.assertEQ( a.meth((-1).toShort()), "short" ) arktest.assertEQ( a.meth(-1 as byte), "byte" ) arktest.assertEQ( a.meth(c'A'), "char" ) arktest.assertEQ( a.meth(false), "boolean" ) @@ -100,16 +100,16 @@ cases: use: |- let a: A = new A() arktest.assertEQ( a.meth(new Byte(-1 as byte)), "byte" ) - arktest.assertEQ( a.meth(new Short(-1 as short)), "short" ) - arktest.assertEQ( a.meth(new Int(-1 as int)), "int" ) - arktest.assertEQ( a.meth(new Long(-1 as long)), "long" ) + arktest.assertEQ( a.meth(new Short((-1)).toShort()), "short" ) + arktest.assertEQ( a.meth(new Int((-1).toInt())), "int" ) + arktest.assertEQ( a.meth(new Long((-1).toLong())), "long" ) arktest.assertEQ( a.meth(new Char(c'A')), "char" ) arktest.assertEQ( a.meth(new Boolean(false)), "boolean" ) arktest.assertEQ( a.meth(new Float(3.14.toFloat())), "float" ) arktest.assertEQ( a.meth(new Double(3.14)), "double" ) - arktest.assertEQ( a.meth(-1 as long), "long" ) - arktest.assertEQ( a.meth(-1 as int), "int" ) - arktest.assertEQ( a.meth(-1 as short), "short" ) + arktest.assertEQ( a.meth((-1).toLong()), "long" ) + arktest.assertEQ( a.meth((-1).toInt()), "int" ) + arktest.assertEQ( a.meth((-1).toShort()), "short" ) arktest.assertEQ( a.meth(-1 as byte), "byte" ) arktest.assertEQ( a.meth(c'A'), "char" ) arktest.assertEQ( a.meth(false), "boolean" ) @@ -129,9 +129,9 @@ cases: } use: |- let a: A = new A() - arktest.assertEQ( a.meth(-1), "int" ) + arktest.assertEQ( a.meth((-1).toInt()), "int" ) arktest.assertEQ( a.meth(Color.Red), "Color" ) - arktest.assertEQ( a.meth(-2 as short), "short" ) + arktest.assertEQ( a.meth((-2).toShort()), "short" ) arktest.assertEQ( a.meth("abc"), "string" ) arktest.assertEQ( a.meth(Size.L), "Size" ) arktest.assertEQ( a.meth(42 as byte), "int" ) diff --git a/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/02.assignment-like_contexts/prim_unboxing.params.yaml b/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/02.assignment-like_contexts/prim_unboxing.params.yaml index 8f29cdc9c9..7442775a3e 100644 --- a/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/02.assignment-like_contexts/prim_unboxing.params.yaml +++ b/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/02.assignment-like_contexts/prim_unboxing.params.yaml @@ -19,5 +19,5 @@ unboxing_conversions: - { origin: Char, dest: char, value: "c'a'" } - { origin: Int, dest: int, value: 1 } - { origin: Long, dest: long, value: new Long(1 as long) } - - { origin: Float, dest: float, value: new Float(1.0 as float) } + - { origin: Float, dest: float, value: new Float(1.0) } - { origin: Double, dest: double, value: 1.0 } diff --git a/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/04.casting_contexts_and_conversions/01.numeric_casting_conversions/unboxing.params.yaml b/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/04.casting_contexts_and_conversions/01.numeric_casting_conversions/unboxing.params.yaml index 47acb2c5e5..6dd6fe055c 100644 --- a/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/04.casting_contexts_and_conversions/01.numeric_casting_conversions/unboxing.params.yaml +++ b/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/04.casting_contexts_and_conversions/01.numeric_casting_conversions/unboxing.params.yaml @@ -19,5 +19,5 @@ cases: - { type: Short, val: 0x5555 as short } - { type: Int, val: 0x12121212 as int } - { type: Long, val: 0x3434343456565656 as long } - - { type: Float, val: 0.00001 as float } + - { type: Float, val: 0.00001f } - { type: Double, val: 0.00000000001 as double } diff --git a/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/04.casting_contexts_and_conversions/02.class_or_interface_casting_conversions/predef_ref.ets b/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/04.casting_contexts_and_conversions/02.class_or_interface_casting_conversions/predef_ref.ets index f4b98dad1a..7f66a42d8b 100644 --- a/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/04.casting_contexts_and_conversions/02.class_or_interface_casting_conversions/predef_ref.ets +++ b/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/04.casting_contexts_and_conversions/02.class_or_interface_casting_conversions/predef_ref.ets @@ -18,14 +18,12 @@ desc: Casting contexts allow the use of the narrowing reference conversion. ---*/ -function main(): int { +function main() { {%- for t in c['types'] %} let s{{loop.index}}: {{t.stype}} = new {{t.dtype}}({{t.pval}}); let d{{loop.index}}: {{t.dtype}} = s{{loop.index}} as {{t.dtype}}; - if (d{{loop.index}} != {{t.pval}}) { - return 1; - } + arktest.assertEQ(d{{loop.index}}, {{t.pval}}) + {%- endfor %} - return 0; } {% endfor %} diff --git a/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/04.casting_contexts_and_conversions/02.class_or_interface_casting_conversions/predef_ref.params.yaml b/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/04.casting_contexts_and_conversions/02.class_or_interface_casting_conversions/predef_ref.params.yaml index 5ed8a51c9f..a1c8abe751 100644 --- a/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/04.casting_contexts_and_conversions/02.class_or_interface_casting_conversions/predef_ref.params.yaml +++ b/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/04.casting_contexts_and_conversions/02.class_or_interface_casting_conversions/predef_ref.params.yaml @@ -21,8 +21,8 @@ cases: - { dtype: Byte, stype: Object, pval: 0x55 as byte } - { dtype: Byte, stype: Numeric, pval: 0x7F as byte } - - { dtype: Byte, stype: Integral, pval: 0x80 as byte } - - { dtype: Byte, stype: Comparable, pval: 0x80 as byte } + - { dtype: Byte, stype: Integral, pval: Int.toByte(0x80) } + - { dtype: Byte, stype: Comparable, pval: Int.toByte(0x80) } - { dtype: Char, stype: Object, pval: "c'W'" } - { dtype: Char, stype: Comparable, pval: "c'Z'" } @@ -49,7 +49,7 @@ cases: - { dtype: Double, stype: Object, pval: '0.00000000001' } - { dtype: Double, stype: Numeric, pval: '0.00000000001' } - - { dtype: Double, stype: Floating, pval: '0.00000000001' } + - { dtype: Double, stype: Floating, pval: '0.00000000001f' } - { dtype: Double, stype: Comparable, pval: '0.00000000001' } - { dtype: String, stype: Object, pval: '"ABC"' } diff --git a/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/04.casting_contexts_and_conversions/identity.params.yaml b/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/04.casting_contexts_and_conversions/identity.params.yaml index e223599d7d..85ec08ebf4 100644 --- a/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/04.casting_contexts_and_conversions/identity.params.yaml +++ b/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/04.casting_contexts_and_conversions/identity.params.yaml @@ -19,7 +19,7 @@ cases: - { type: short, expr: 0x5555 as short, op: '!=' } - { type: int, expr: 0x12121212 as int, op: '!=' } - { type: long, expr: 0x3434343456565656 as long, op: '!=' } - - { type: float, expr: 0.00001 as float, op: '!=' } + - { type: float, expr: 0.00001f, op: '!=' } - { type: double, expr: 0.00000000001 as double, op: '!=' } - { type: Boolean, expr: new Boolean(true), op: '!==' } - { type: Byte, expr: new Byte(new Int(1).toByte()), op: '!==' } diff --git a/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/04.casting_contexts_and_conversions/invalid.params.yaml b/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/04.casting_contexts_and_conversions/invalid.params.yaml index d83cf15545..8d53379138 100644 --- a/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/04.casting_contexts_and_conversions/invalid.params.yaml +++ b/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/04.casting_contexts_and_conversions/invalid.params.yaml @@ -64,8 +64,8 @@ cases: - { stype: Long, sval: new Long(0 as long), dtype: boolean } - { stype: Long, sval: new Long(0 as long), dtype: Boolean } - - { stype: Float, sval: new Float(0 as float), dtype: boolean } - - { stype: Float, sval: new Float(0 as float), dtype: Boolean } + - { stype: Float, sval: new Float(0), dtype: boolean } + - { stype: Float, sval: new Float(0), dtype: Boolean } - { stype: Double, sval: new Double(0 as double), dtype: boolean } - { stype: Double, sval: new Double(0 as double), dtype: Boolean } diff --git a/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/04.casting_contexts_and_conversions/widening_refs.params.yaml b/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/04.casting_contexts_and_conversions/widening_refs.params.yaml index 978a9ec74f..8f0bc03a24 100644 --- a/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/04.casting_contexts_and_conversions/widening_refs.params.yaml +++ b/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/04.casting_contexts_and_conversions/widening_refs.params.yaml @@ -24,7 +24,7 @@ cases: - { stype: Int, expr: new Int(0x12121212 as int), dtype: Integral } - { stype: Long, expr: new Long(0x3434343456565656 as long), dtype: Object } - { stype: Long, expr: new Long(0x3434343456565656 as long), dtype: Integral } - - { stype: Float, expr: new Float(0.00001 as float), dtype: Object } - - { stype: Float, expr: new Float(0.00001 as float), dtype: Floating } + - { stype: Float, expr: new Float(0.00001), dtype: Object } + - { stype: Float, expr: new Float(0.00001), dtype: Floating } - { stype: Double, expr: new Double(0.00000000001 as double), dtype: Object } - { stype: Double, expr: new Double(0.00000000001 as double), dtype: Floating } diff --git a/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/04.widening_union_conversions/assn_var/assn-var-un.params.yaml b/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/04.widening_union_conversions/assn_var/assn-var-un.params.yaml index f41c22137d..cd5273356b 100644 --- a/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/04.widening_union_conversions/assn_var/assn-var-un.params.yaml +++ b/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/04.widening_union_conversions/assn_var/assn-var-un.params.yaml @@ -152,7 +152,7 @@ cases: - { from_type: 'A', ref_type: 'A', expr: 'a', eq: '===' } - { from_type: 'B', ref_type: 'B', expr: 'b', eq: '===' } - { from_type: 'float', ref_type: 'Float', expr: '2.5e02f', eq: '==' } - - { from_type: 'short', ref_type: 'Short', expr: '0x8001 as short', eq: '==' } + - { from_type: 'short', ref_type: 'Short', expr: '(0x8001).toShort()', eq: '==' } - { from_type: 'boolean', ref_type: 'Boolean', expr: '!!false', eq: '==' } - { from_type: 'undefined', ref_type: 'undefined', expr: 'u', eq: '==' } - { from_type: 'null', ref_type: 'null', expr: 'n', eq: '==' } diff --git a/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/04.widening_union_conversions/assn_var/assn-var-wd.params.yaml b/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/04.widening_union_conversions/assn_var/assn-var-wd.params.yaml index e15ee3523b..3d82df9c0e 100644 --- a/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/04.widening_union_conversions/assn_var/assn-var-wd.params.yaml +++ b/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/04.widening_union_conversions/assn_var/assn-var-wd.params.yaml @@ -23,8 +23,8 @@ cases: decl: |- let vByte: Byte = new Byte(127 as byte) let vInt: Int = new Int(-7) - let vShort: Short = new Short(0xCAFE as short) - let vLong: Long = new Long(0o777 as long) + let vShort: Short = new Short((0xCAFE).toShort()) + let vLong: Long = new Long((0o777).toLong()) values: - { from_type: 'Byte|Long', expr: vByte, eq: '===' } - { from_type: 'Short|Byte|Int', expr: vInt, eq: '===' } @@ -61,8 +61,8 @@ cases: decl: |- let vByte: Byte = new Byte(127 as byte) let vInt: Int = new Int(-7) - let vShort: Short = new Short(0xCAFE as short) - let vLong: Long = new Long(0o777 as long) + let vShort: Short = new Short((0xCAFE).toShort()) + let vLong: Long = new Long((0o777).toLong()) let vFloat: Float = new Float(3.5f) let vDouble: Double = new Double(-1.1E-20) let vNumber: Number = new Number(1234567e8) @@ -77,9 +77,9 @@ cases: - to_type: byte|short|int|long|boolean|char|float|double|bigint|string values: - { from_type: 'byte|boolean|char', ref_type: Byte, expr: '127 as byte', eq: '==' } - - { from_type: 'short|char|string|double', ref_type: Short, expr: '0xCAFE as short', eq: '==' } + - { from_type: 'short|char|string|double', ref_type: Short, expr: '(0xCAFE).toShort()', eq: '==' } - { from_type: 'int|boolean', ref_type: Int, expr: -7, eq: '==' } - - { from_type: 'long|string|long|string|boolean', ref_type: Long, expr: 0o777 as long, eq: '==' } + - { from_type: 'long|string|long|string|boolean', ref_type: Long, expr: (0o777).toLong(), eq: '==' } - { from_type: 'char|byte|short', ref_type: Char, expr: "c'\\u5C5C'", eq: '==' } - { from_type: 'boolean|string', ref_type: Boolean, expr: 'false', eq: '==' } - { from_type: 'float|bigint', ref_type: Float, expr: 3.5f, eq: '==' } diff --git a/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/04.widening_union_conversions/call_cons/call-cons-un.params.yaml b/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/04.widening_union_conversions/call_cons/call-cons-un.params.yaml index 2f5dabbef4..e6004bc920 100644 --- a/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/04.widening_union_conversions/call_cons/call-cons-un.params.yaml +++ b/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/04.widening_union_conversions/call_cons/call-cons-un.params.yaml @@ -152,7 +152,7 @@ cases: - { from_type: 'A', ref_type: 'A', expr: 'a', eq: '===' } - { from_type: 'B', ref_type: 'B', expr: 'b', eq: '===' } - { from_type: 'float', ref_type: 'Float', expr: '2.5e02f', eq: '==' } - - { from_type: 'short', ref_type: 'Short', expr: '0x8001 as short', eq: '==' } + - { from_type: 'short', ref_type: 'Short', expr: '(0x8001).toShort()', eq: '==' } - { from_type: 'boolean', ref_type: 'Boolean', expr: '!!false', eq: '==' } - { from_type: 'undefined', ref_type: 'undefined', expr: 'u', eq: '==' } - { from_type: 'null', ref_type: 'null', expr: 'n', eq: '==' } diff --git a/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/04.widening_union_conversions/call_cons/call-cons-wd.params.yaml b/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/04.widening_union_conversions/call_cons/call-cons-wd.params.yaml index e15ee3523b..3d82df9c0e 100644 --- a/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/04.widening_union_conversions/call_cons/call-cons-wd.params.yaml +++ b/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/04.widening_union_conversions/call_cons/call-cons-wd.params.yaml @@ -23,8 +23,8 @@ cases: decl: |- let vByte: Byte = new Byte(127 as byte) let vInt: Int = new Int(-7) - let vShort: Short = new Short(0xCAFE as short) - let vLong: Long = new Long(0o777 as long) + let vShort: Short = new Short((0xCAFE).toShort()) + let vLong: Long = new Long((0o777).toLong()) values: - { from_type: 'Byte|Long', expr: vByte, eq: '===' } - { from_type: 'Short|Byte|Int', expr: vInt, eq: '===' } @@ -61,8 +61,8 @@ cases: decl: |- let vByte: Byte = new Byte(127 as byte) let vInt: Int = new Int(-7) - let vShort: Short = new Short(0xCAFE as short) - let vLong: Long = new Long(0o777 as long) + let vShort: Short = new Short((0xCAFE).toShort()) + let vLong: Long = new Long((0o777).toLong()) let vFloat: Float = new Float(3.5f) let vDouble: Double = new Double(-1.1E-20) let vNumber: Number = new Number(1234567e8) @@ -77,9 +77,9 @@ cases: - to_type: byte|short|int|long|boolean|char|float|double|bigint|string values: - { from_type: 'byte|boolean|char', ref_type: Byte, expr: '127 as byte', eq: '==' } - - { from_type: 'short|char|string|double', ref_type: Short, expr: '0xCAFE as short', eq: '==' } + - { from_type: 'short|char|string|double', ref_type: Short, expr: '(0xCAFE).toShort()', eq: '==' } - { from_type: 'int|boolean', ref_type: Int, expr: -7, eq: '==' } - - { from_type: 'long|string|long|string|boolean', ref_type: Long, expr: 0o777 as long, eq: '==' } + - { from_type: 'long|string|long|string|boolean', ref_type: Long, expr: (0o777).toLong(), eq: '==' } - { from_type: 'char|byte|short', ref_type: Char, expr: "c'\\u5C5C'", eq: '==' } - { from_type: 'boolean|string', ref_type: Boolean, expr: 'false', eq: '==' } - { from_type: 'float|bigint', ref_type: Float, expr: 3.5f, eq: '==' } diff --git a/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/04.widening_union_conversions/call_func/call-func-un.params.yaml b/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/04.widening_union_conversions/call_func/call-func-un.params.yaml index bade4e8fb1..7c4a99ec61 100644 --- a/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/04.widening_union_conversions/call_func/call-func-un.params.yaml +++ b/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/04.widening_union_conversions/call_func/call-func-un.params.yaml @@ -152,7 +152,7 @@ cases: - { from_type: 'A', ref_type: 'A', expr: 'a', eq: '===' } - { from_type: 'B', ref_type: 'B', expr: 'b', eq: '===' } - { from_type: 'float', ref_type: 'Float', expr: '2.5e02f', eq: '==' } - - { from_type: 'short', ref_type: 'Short', expr: '0x8001 as short', eq: '==' } + - { from_type: 'short', ref_type: 'Short', expr: '(0x8001).toShort()', eq: '==' } - { from_type: 'boolean', ref_type: 'Boolean', expr: '!!false', eq: '==' } - { from_type: 'undefined', ref_type: 'undefined', expr: 'u', eq: '==' } - { from_type: 'null', ref_type: 'null', expr: 'n', eq: '==' } diff --git a/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/04.widening_union_conversions/call_func/call-func-wd.params.yaml b/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/04.widening_union_conversions/call_func/call-func-wd.params.yaml index e15ee3523b..3d82df9c0e 100644 --- a/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/04.widening_union_conversions/call_func/call-func-wd.params.yaml +++ b/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/04.widening_union_conversions/call_func/call-func-wd.params.yaml @@ -23,8 +23,8 @@ cases: decl: |- let vByte: Byte = new Byte(127 as byte) let vInt: Int = new Int(-7) - let vShort: Short = new Short(0xCAFE as short) - let vLong: Long = new Long(0o777 as long) + let vShort: Short = new Short((0xCAFE).toShort()) + let vLong: Long = new Long((0o777).toLong()) values: - { from_type: 'Byte|Long', expr: vByte, eq: '===' } - { from_type: 'Short|Byte|Int', expr: vInt, eq: '===' } @@ -61,8 +61,8 @@ cases: decl: |- let vByte: Byte = new Byte(127 as byte) let vInt: Int = new Int(-7) - let vShort: Short = new Short(0xCAFE as short) - let vLong: Long = new Long(0o777 as long) + let vShort: Short = new Short((0xCAFE).toShort()) + let vLong: Long = new Long((0o777).toLong()) let vFloat: Float = new Float(3.5f) let vDouble: Double = new Double(-1.1E-20) let vNumber: Number = new Number(1234567e8) @@ -77,9 +77,9 @@ cases: - to_type: byte|short|int|long|boolean|char|float|double|bigint|string values: - { from_type: 'byte|boolean|char', ref_type: Byte, expr: '127 as byte', eq: '==' } - - { from_type: 'short|char|string|double', ref_type: Short, expr: '0xCAFE as short', eq: '==' } + - { from_type: 'short|char|string|double', ref_type: Short, expr: '(0xCAFE).toShort()', eq: '==' } - { from_type: 'int|boolean', ref_type: Int, expr: -7, eq: '==' } - - { from_type: 'long|string|long|string|boolean', ref_type: Long, expr: 0o777 as long, eq: '==' } + - { from_type: 'long|string|long|string|boolean', ref_type: Long, expr: (0o777).toLong(), eq: '==' } - { from_type: 'char|byte|short', ref_type: Char, expr: "c'\\u5C5C'", eq: '==' } - { from_type: 'boolean|string', ref_type: Boolean, expr: 'false', eq: '==' } - { from_type: 'float|bigint', ref_type: Float, expr: 3.5f, eq: '==' } diff --git a/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/04.widening_union_conversions/call_lmbd/call-lmbd-un.params.yaml b/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/04.widening_union_conversions/call_lmbd/call-lmbd-un.params.yaml index 30df95f7a8..425a9341b7 100644 --- a/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/04.widening_union_conversions/call_lmbd/call-lmbd-un.params.yaml +++ b/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/04.widening_union_conversions/call_lmbd/call-lmbd-un.params.yaml @@ -152,7 +152,7 @@ cases: - { from_type: 'A', ref_type: 'A', expr: 'a', eq: '===' } - { from_type: 'B', ref_type: 'B', expr: 'b', eq: '===' } - { from_type: 'float', ref_type: 'Float', expr: '2.5e02f', eq: '==' } - - { from_type: 'short', ref_type: 'Short', expr: '0x8001 as short', eq: '==' } + - { from_type: 'short', ref_type: 'Short', expr: '(0x8001).toShort()', eq: '==' } - { from_type: 'boolean', ref_type: 'Boolean', expr: '!!false', eq: '==' } - { from_type: 'undefined', ref_type: 'undefined', expr: 'u', eq: '==' } - { from_type: 'null', ref_type: 'null', expr: 'n', eq: '==' } diff --git a/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/04.widening_union_conversions/call_lmbd/call-lmbd-wd.params.yaml b/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/04.widening_union_conversions/call_lmbd/call-lmbd-wd.params.yaml index e15ee3523b..3d82df9c0e 100644 --- a/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/04.widening_union_conversions/call_lmbd/call-lmbd-wd.params.yaml +++ b/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/04.widening_union_conversions/call_lmbd/call-lmbd-wd.params.yaml @@ -23,8 +23,8 @@ cases: decl: |- let vByte: Byte = new Byte(127 as byte) let vInt: Int = new Int(-7) - let vShort: Short = new Short(0xCAFE as short) - let vLong: Long = new Long(0o777 as long) + let vShort: Short = new Short((0xCAFE).toShort()) + let vLong: Long = new Long((0o777).toLong()) values: - { from_type: 'Byte|Long', expr: vByte, eq: '===' } - { from_type: 'Short|Byte|Int', expr: vInt, eq: '===' } @@ -61,8 +61,8 @@ cases: decl: |- let vByte: Byte = new Byte(127 as byte) let vInt: Int = new Int(-7) - let vShort: Short = new Short(0xCAFE as short) - let vLong: Long = new Long(0o777 as long) + let vShort: Short = new Short((0xCAFE).toShort()) + let vLong: Long = new Long((0o777).toLong()) let vFloat: Float = new Float(3.5f) let vDouble: Double = new Double(-1.1E-20) let vNumber: Number = new Number(1234567e8) @@ -77,9 +77,9 @@ cases: - to_type: byte|short|int|long|boolean|char|float|double|bigint|string values: - { from_type: 'byte|boolean|char', ref_type: Byte, expr: '127 as byte', eq: '==' } - - { from_type: 'short|char|string|double', ref_type: Short, expr: '0xCAFE as short', eq: '==' } + - { from_type: 'short|char|string|double', ref_type: Short, expr: '(0xCAFE).toShort()', eq: '==' } - { from_type: 'int|boolean', ref_type: Int, expr: -7, eq: '==' } - - { from_type: 'long|string|long|string|boolean', ref_type: Long, expr: 0o777 as long, eq: '==' } + - { from_type: 'long|string|long|string|boolean', ref_type: Long, expr: (0o777).toLong(), eq: '==' } - { from_type: 'char|byte|short', ref_type: Char, expr: "c'\\u5C5C'", eq: '==' } - { from_type: 'boolean|string', ref_type: Boolean, expr: 'false', eq: '==' } - { from_type: 'float|bigint', ref_type: Float, expr: 3.5f, eq: '==' } diff --git a/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/04.widening_union_conversions/call_meth/call-meth-un.params.yaml b/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/04.widening_union_conversions/call_meth/call-meth-un.params.yaml index 238e2e53f3..180c700ddd 100644 --- a/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/04.widening_union_conversions/call_meth/call-meth-un.params.yaml +++ b/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/04.widening_union_conversions/call_meth/call-meth-un.params.yaml @@ -152,7 +152,7 @@ cases: - { from_type: 'A', ref_type: 'A', expr: 'a', eq: '===' } - { from_type: 'B', ref_type: 'B', expr: 'b', eq: '===' } - { from_type: 'float', ref_type: 'Float', expr: '2.5e02f', eq: '==' } - - { from_type: 'short', ref_type: 'Short', expr: '0x8001 as short', eq: '==' } + - { from_type: 'short', ref_type: 'Short', expr: '(0x8001).toShort()', eq: '==' } - { from_type: 'boolean', ref_type: 'Boolean', expr: '!!false', eq: '==' } - { from_type: 'undefined', ref_type: 'undefined', expr: 'u', eq: '==' } - { from_type: 'null', ref_type: 'null', expr: 'n', eq: '==' } diff --git a/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/04.widening_union_conversions/call_meth/call-meth-wd.params.yaml b/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/04.widening_union_conversions/call_meth/call-meth-wd.params.yaml index e15ee3523b..3d82df9c0e 100644 --- a/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/04.widening_union_conversions/call_meth/call-meth-wd.params.yaml +++ b/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/04.widening_union_conversions/call_meth/call-meth-wd.params.yaml @@ -23,8 +23,8 @@ cases: decl: |- let vByte: Byte = new Byte(127 as byte) let vInt: Int = new Int(-7) - let vShort: Short = new Short(0xCAFE as short) - let vLong: Long = new Long(0o777 as long) + let vShort: Short = new Short((0xCAFE).toShort()) + let vLong: Long = new Long((0o777).toLong()) values: - { from_type: 'Byte|Long', expr: vByte, eq: '===' } - { from_type: 'Short|Byte|Int', expr: vInt, eq: '===' } @@ -61,8 +61,8 @@ cases: decl: |- let vByte: Byte = new Byte(127 as byte) let vInt: Int = new Int(-7) - let vShort: Short = new Short(0xCAFE as short) - let vLong: Long = new Long(0o777 as long) + let vShort: Short = new Short((0xCAFE).toShort()) + let vLong: Long = new Long((0o777).toLong()) let vFloat: Float = new Float(3.5f) let vDouble: Double = new Double(-1.1E-20) let vNumber: Number = new Number(1234567e8) @@ -77,9 +77,9 @@ cases: - to_type: byte|short|int|long|boolean|char|float|double|bigint|string values: - { from_type: 'byte|boolean|char', ref_type: Byte, expr: '127 as byte', eq: '==' } - - { from_type: 'short|char|string|double', ref_type: Short, expr: '0xCAFE as short', eq: '==' } + - { from_type: 'short|char|string|double', ref_type: Short, expr: '(0xCAFE).toShort()', eq: '==' } - { from_type: 'int|boolean', ref_type: Int, expr: -7, eq: '==' } - - { from_type: 'long|string|long|string|boolean', ref_type: Long, expr: 0o777 as long, eq: '==' } + - { from_type: 'long|string|long|string|boolean', ref_type: Long, expr: (0o777).toLong(), eq: '==' } - { from_type: 'char|byte|short', ref_type: Char, expr: "c'\\u5C5C'", eq: '==' } - { from_type: 'boolean|string', ref_type: Boolean, expr: 'false', eq: '==' } - { from_type: 'float|bigint', ref_type: Float, expr: 3.5f, eq: '==' } diff --git a/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/04.widening_union_conversions/comp_arr/comp-arr-un.params.yaml b/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/04.widening_union_conversions/comp_arr/comp-arr-un.params.yaml index 450189ed3a..ad02350ce1 100644 --- a/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/04.widening_union_conversions/comp_arr/comp-arr-un.params.yaml +++ b/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/04.widening_union_conversions/comp_arr/comp-arr-un.params.yaml @@ -152,7 +152,7 @@ cases: - { from_type: 'A', ref_type: 'A', expr: 'a', eq: '===' } - { from_type: 'B', ref_type: 'B', expr: 'b', eq: '===' } - { from_type: 'float', ref_type: 'Float', expr: '2.5e02f', eq: '==' } - - { from_type: 'short', ref_type: 'Short', expr: '0x8001 as short', eq: '==' } + - { from_type: 'short', ref_type: 'Short', expr: '(0x8001).toShort()', eq: '==' } - { from_type: 'boolean', ref_type: 'Boolean', expr: '!!false', eq: '==' } - { from_type: 'undefined', ref_type: 'undefined', expr: 'u', eq: '==' } - { from_type: 'null', ref_type: 'null', expr: 'n', eq: '==' } diff --git a/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/04.widening_union_conversions/comp_arr/comp-arr-wd.params.yaml b/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/04.widening_union_conversions/comp_arr/comp-arr-wd.params.yaml index e15ee3523b..4c9791b6c4 100644 --- a/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/04.widening_union_conversions/comp_arr/comp-arr-wd.params.yaml +++ b/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/04.widening_union_conversions/comp_arr/comp-arr-wd.params.yaml @@ -23,8 +23,8 @@ cases: decl: |- let vByte: Byte = new Byte(127 as byte) let vInt: Int = new Int(-7) - let vShort: Short = new Short(0xCAFE as short) - let vLong: Long = new Long(0o777 as long) + let vShort: Short = new Short((0xCAFE).toShort()) + let vLong: Long = new Long((0o777).toLong()) values: - { from_type: 'Byte|Long', expr: vByte, eq: '===' } - { from_type: 'Short|Byte|Int', expr: vInt, eq: '===' } @@ -61,8 +61,8 @@ cases: decl: |- let vByte: Byte = new Byte(127 as byte) let vInt: Int = new Int(-7) - let vShort: Short = new Short(0xCAFE as short) - let vLong: Long = new Long(0o777 as long) + let vShort: Short = new Short((0xCAFE).toShort()) + let vLong: Long = new Long((0o777).toLong()) let vFloat: Float = new Float(3.5f) let vDouble: Double = new Double(-1.1E-20) let vNumber: Number = new Number(1234567e8) @@ -77,9 +77,9 @@ cases: - to_type: byte|short|int|long|boolean|char|float|double|bigint|string values: - { from_type: 'byte|boolean|char', ref_type: Byte, expr: '127 as byte', eq: '==' } - - { from_type: 'short|char|string|double', ref_type: Short, expr: '0xCAFE as short', eq: '==' } + - { from_type: 'short|char|string|double', ref_type: Short, expr: '(0xCAFE).toShort()', eq: '==' } - { from_type: 'int|boolean', ref_type: Int, expr: -7, eq: '==' } - - { from_type: 'long|string|long|string|boolean', ref_type: Long, expr: 0o777 as long, eq: '==' } + - { from_type: 'long|string|long|string|boolean', ref_type: Long, expr: '(0o777).toLong()', eq: '==' } - { from_type: 'char|byte|short', ref_type: Char, expr: "c'\\u5C5C'", eq: '==' } - { from_type: 'boolean|string', ref_type: Boolean, expr: 'false', eq: '==' } - { from_type: 'float|bigint', ref_type: Float, expr: 3.5f, eq: '==' } diff --git a/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/04.widening_union_conversions/comp_obj/comp-obj-un.params.yaml b/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/04.widening_union_conversions/comp_obj/comp-obj-un.params.yaml index df54e30d8f..556ad0e3a2 100644 --- a/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/04.widening_union_conversions/comp_obj/comp-obj-un.params.yaml +++ b/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/04.widening_union_conversions/comp_obj/comp-obj-un.params.yaml @@ -159,7 +159,7 @@ cases: - { from_type: 'A', ref_type: 'A', expr: 'a', eq: '===' } - { from_type: 'B', ref_type: 'B', expr: 'b', eq: '===' } - { from_type: 'float', ref_type: 'Float', expr: '2.5e02f', eq: '==' } - - { from_type: 'short', ref_type: 'Short', expr: '0x8001 as short', eq: '==' } + - { from_type: 'short', ref_type: 'Short', expr: '(0x8001).toShort()', eq: '==' } - { from_type: 'boolean', ref_type: 'Boolean', expr: '!!false', eq: '==' } - { from_type: 'undefined', ref_type: 'undefined', expr: 'u', eq: '==' } - { from_type: 'null', ref_type: 'null', expr: 'n', eq: '==' } diff --git a/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/04.widening_union_conversions/comp_obj/comp-obj-wd.params.yaml b/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/04.widening_union_conversions/comp_obj/comp-obj-wd.params.yaml index d1f32ba7a9..edd259ed7a 100644 --- a/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/04.widening_union_conversions/comp_obj/comp-obj-wd.params.yaml +++ b/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/04.widening_union_conversions/comp_obj/comp-obj-wd.params.yaml @@ -24,8 +24,8 @@ cases: decl: |- let vByte: Byte = new Byte(127 as byte) let vInt: Int = new Int(-7) - let vShort: Short = new Short(0xCAFE as short) - let vLong: Long = new Long(0o777 as long) + let vShort: Short = new Short((0xCAFE).toShort()) + let vLong: Long = new Long((0o777).toLong()) values: - { from_type: 'Byte|Long', expr: vByte, eq: '===' } - { from_type: 'Short|Byte|Int', expr: vInt, eq: '===' } @@ -64,8 +64,8 @@ cases: decl: |- let vByte: Byte = new Byte(127 as byte) let vInt: Int = new Int(-7) - let vShort: Short = new Short(0xCAFE as short) - let vLong: Long = new Long(0o777 as long) + let vShort: Short = new Short((0xCAFE).toShort()) + let vLong: Long = new Long((0o777).toLong()) let vFloat: Float = new Float(3.5f) let vDouble: Double = new Double(-1.1E-20) let vNumber: Number = new Number(1234567e8) @@ -81,9 +81,9 @@ cases: init_value: 0 values: - { from_type: 'byte|boolean|char', ref_type: Byte, expr: '127 as byte', eq: '==' } - - { from_type: 'short|char|string|double', ref_type: Short, expr: '0xCAFE as short', eq: '==' } + - { from_type: 'short|char|string|double', ref_type: Short, expr: '(0xCAFE).toShort()', eq: '==' } - { from_type: 'int|boolean', ref_type: Int, expr: -7, eq: '==' } - - { from_type: 'long|string|long|string|boolean', ref_type: Long, expr: 0o777 as long, eq: '==' } + - { from_type: 'long|string|long|string|boolean', ref_type: Long, expr: (0o777).toLong(), eq: '==' } - { from_type: 'char|byte|short', ref_type: Char, expr: "c'\\u5C5C'", eq: '==' } - { from_type: 'boolean|string', ref_type: Boolean, expr: 'false', eq: '==' } - { from_type: 'float|bigint', ref_type: Float, expr: 3.5f, eq: '==' } diff --git a/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/04.widening_union_conversions/decl_field/decl-field-un.params.yaml b/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/04.widening_union_conversions/decl_field/decl-field-un.params.yaml index c732e17f68..031884766d 100644 --- a/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/04.widening_union_conversions/decl_field/decl-field-un.params.yaml +++ b/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/04.widening_union_conversions/decl_field/decl-field-un.params.yaml @@ -159,7 +159,7 @@ cases: - { from_type: 'A', ref_type: 'A', expr: 'a', eq: '===' } - { from_type: 'B', ref_type: 'B', expr: 'b', eq: '===' } - { from_type: 'float', ref_type: 'Float', expr: '2.5e02f', eq: '==' } - - { from_type: 'short', ref_type: 'Short', expr: '0x8001 as short', eq: '==' } + - { from_type: 'short', ref_type: 'Short', expr: '(0x8001).toShort()', eq: '==' } - { from_type: 'boolean', ref_type: 'Boolean', expr: '!!false', eq: '==' } - { from_type: 'undefined', ref_type: 'undefined', expr: 'u', eq: '==' } - { from_type: 'null', ref_type: 'null', expr: 'n', eq: '==' } diff --git a/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/04.widening_union_conversions/decl_field/decl-field-wd.params.yaml b/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/04.widening_union_conversions/decl_field/decl-field-wd.params.yaml index b33d973889..923271b994 100644 --- a/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/04.widening_union_conversions/decl_field/decl-field-wd.params.yaml +++ b/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/04.widening_union_conversions/decl_field/decl-field-wd.params.yaml @@ -24,8 +24,8 @@ cases: decl: |- let vByte: Byte = new Byte(127 as byte) let vInt: Int = new Int(-7) - let vShort: Short = new Short(0xCAFE as short) - let vLong: Long = new Long(0o777 as long) + let vShort: Short = new Short((0xCAFE).toShort()) + let vLong: Long = new Long((0o777).toLong()) values: - { from_type: 'Byte|Long', expr: vByte, eq: '===' } - { from_type: 'Short|Byte|Int', expr: vInt, eq: '===' } @@ -64,8 +64,8 @@ cases: decl: |- let vByte: Byte = new Byte(127 as byte) let vInt: Int = new Int(-7) - let vShort: Short = new Short(0xCAFE as short) - let vLong: Long = new Long(0o777 as long) + let vShort: Short = new Short((0xCAFE).toShort()) + let vLong: Long = new Long((0o777).toLong()) let vFloat: Float = new Float(3.5f) let vDouble: Double = new Double(-1.1E-20) let vNumber: Number = new Number(1234567e8) @@ -81,9 +81,9 @@ cases: init_value: 0 values: - { from_type: 'byte|boolean|char', ref_type: Byte, expr: '127 as byte', eq: '==' } - - { from_type: 'short|char|string|double', ref_type: Short, expr: '0xCAFE as short', eq: '==' } + - { from_type: 'short|char|string|double', ref_type: Short, expr: '(0xCAFE).toShort()', eq: '==' } - { from_type: 'int|boolean', ref_type: Int, expr: -7, eq: '==' } - - { from_type: 'long|string|long|string|boolean', ref_type: Long, expr: 0o777 as long, eq: '==' } + - { from_type: 'long|string|long|string|boolean', ref_type: Long, expr: (0o777).toLong(), eq: '==' } - { from_type: 'char|byte|short', ref_type: Char, expr: "c'\\u5C5C'", eq: '==' } - { from_type: 'boolean|string', ref_type: Boolean, expr: 'false', eq: '==' } - { from_type: 'float|bigint', ref_type: Float, expr: 3.5f, eq: '==' } diff --git a/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/04.widening_union_conversions/decl_var/decl-var-un.params.yaml b/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/04.widening_union_conversions/decl_var/decl-var-un.params.yaml index 23f845f9d0..230645c5dc 100644 --- a/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/04.widening_union_conversions/decl_var/decl-var-un.params.yaml +++ b/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/04.widening_union_conversions/decl_var/decl-var-un.params.yaml @@ -152,7 +152,7 @@ cases: - { from_type: 'A', ref_type: 'A', expr: 'a', eq: '===' } - { from_type: 'B', ref_type: 'B', expr: 'b', eq: '===' } - { from_type: 'float', ref_type: 'Float', expr: '2.5e02f', eq: '==' } - - { from_type: 'short', ref_type: 'Short', expr: '0x8001 as short', eq: '==' } + - { from_type: 'short', ref_type: 'Short', expr: '(0x8001).toShort()', eq: '==' } - { from_type: 'boolean', ref_type: 'Boolean', expr: '!!false', eq: '==' } - { from_type: 'undefined', ref_type: 'undefined', expr: 'u', eq: '==' } - { from_type: 'null', ref_type: 'null', expr: 'n', eq: '==' } diff --git a/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/04.widening_union_conversions/decl_var/decl-var-wd.params.yaml b/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/04.widening_union_conversions/decl_var/decl-var-wd.params.yaml index e15ee3523b..3d82df9c0e 100644 --- a/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/04.widening_union_conversions/decl_var/decl-var-wd.params.yaml +++ b/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/04.widening_union_conversions/decl_var/decl-var-wd.params.yaml @@ -23,8 +23,8 @@ cases: decl: |- let vByte: Byte = new Byte(127 as byte) let vInt: Int = new Int(-7) - let vShort: Short = new Short(0xCAFE as short) - let vLong: Long = new Long(0o777 as long) + let vShort: Short = new Short((0xCAFE).toShort()) + let vLong: Long = new Long((0o777).toLong()) values: - { from_type: 'Byte|Long', expr: vByte, eq: '===' } - { from_type: 'Short|Byte|Int', expr: vInt, eq: '===' } @@ -61,8 +61,8 @@ cases: decl: |- let vByte: Byte = new Byte(127 as byte) let vInt: Int = new Int(-7) - let vShort: Short = new Short(0xCAFE as short) - let vLong: Long = new Long(0o777 as long) + let vShort: Short = new Short((0xCAFE).toShort()) + let vLong: Long = new Long((0o777).toLong()) let vFloat: Float = new Float(3.5f) let vDouble: Double = new Double(-1.1E-20) let vNumber: Number = new Number(1234567e8) @@ -77,9 +77,9 @@ cases: - to_type: byte|short|int|long|boolean|char|float|double|bigint|string values: - { from_type: 'byte|boolean|char', ref_type: Byte, expr: '127 as byte', eq: '==' } - - { from_type: 'short|char|string|double', ref_type: Short, expr: '0xCAFE as short', eq: '==' } + - { from_type: 'short|char|string|double', ref_type: Short, expr: '(0xCAFE).toShort()', eq: '==' } - { from_type: 'int|boolean', ref_type: Int, expr: -7, eq: '==' } - - { from_type: 'long|string|long|string|boolean', ref_type: Long, expr: 0o777 as long, eq: '==' } + - { from_type: 'long|string|long|string|boolean', ref_type: Long, expr: (0o777).toLong(), eq: '==' } - { from_type: 'char|byte|short', ref_type: Char, expr: "c'\\u5C5C'", eq: '==' } - { from_type: 'boolean|string', ref_type: Boolean, expr: 'false', eq: '==' } - { from_type: 'float|bigint', ref_type: Float, expr: 3.5f, eq: '==' } diff --git a/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/05.widening_reference_conversions/assn_var/assn-var.params.yaml b/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/05.widening_reference_conversions/assn_var/assn-var.params.yaml index 9020a840ef..c10c056c39 100644 --- a/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/05.widening_reference_conversions/assn_var/assn-var.params.yaml +++ b/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/05.widening_reference_conversions/assn_var/assn-var.params.yaml @@ -44,16 +44,15 @@ cases: - from_type: Float values: - { to_type: Floating, expr: new Float(Byte.MIN_VALUE.toFloat()) } - - { to_type: Numeric, expr: new Float(-0.0 as float) } - - { to_type: Object, expr: new Float(+0.0 as float) } - - { to_type: Comparable, expr: new Float(+0.0 as float) } + - { to_type: Numeric, expr: new Float(-0.0f) } + - { to_type: Comparable, expr: new Float(+0.0f) } - from_type: Double values: - { to_type: Floating, expr: new Double(Byte.MIN_VALUE.toDouble()) } - - { to_type: Numeric, expr: new Double(-0.0 as float) } - - { to_type: Object, expr: new Double(+0.0 as float) } - - { to_type: Comparable, expr: new Double(+0.0 as float) } + - { to_type: Numeric, expr: new Double(-0.0f) } + - { to_type: Object, expr: new Double(+0.0f) } + - { to_type: Comparable, expr: new Double(+0.0f) } - from_type: Char values: diff --git a/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/05.widening_reference_conversions/call_cons/call-cons.params.yaml b/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/05.widening_reference_conversions/call_cons/call-cons.params.yaml index 9020a840ef..d2c5245cd2 100644 --- a/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/05.widening_reference_conversions/call_cons/call-cons.params.yaml +++ b/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/05.widening_reference_conversions/call_cons/call-cons.params.yaml @@ -44,16 +44,16 @@ cases: - from_type: Float values: - { to_type: Floating, expr: new Float(Byte.MIN_VALUE.toFloat()) } - - { to_type: Numeric, expr: new Float(-0.0 as float) } - - { to_type: Object, expr: new Float(+0.0 as float) } - - { to_type: Comparable, expr: new Float(+0.0 as float) } + - { to_type: Numeric, expr: new Float(-0.0f) } + - { to_type: Object, expr: new Float(+0.0f) } + - { to_type: Comparable, expr: new Float(+0.0f) } - from_type: Double values: - { to_type: Floating, expr: new Double(Byte.MIN_VALUE.toDouble()) } - - { to_type: Numeric, expr: new Double(-0.0 as float) } - - { to_type: Object, expr: new Double(+0.0 as float) } - - { to_type: Comparable, expr: new Double(+0.0 as float) } + - { to_type: Numeric, expr: new Double(-0.0f) } + - { to_type: Object, expr: new Double(+0.0f) } + - { to_type: Comparable, expr: new Double(+0.0f) } - from_type: Char values: diff --git a/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/05.widening_reference_conversions/call_func/call-func.params.yaml b/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/05.widening_reference_conversions/call_func/call-func.params.yaml index 9020a840ef..d2c5245cd2 100644 --- a/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/05.widening_reference_conversions/call_func/call-func.params.yaml +++ b/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/05.widening_reference_conversions/call_func/call-func.params.yaml @@ -44,16 +44,16 @@ cases: - from_type: Float values: - { to_type: Floating, expr: new Float(Byte.MIN_VALUE.toFloat()) } - - { to_type: Numeric, expr: new Float(-0.0 as float) } - - { to_type: Object, expr: new Float(+0.0 as float) } - - { to_type: Comparable, expr: new Float(+0.0 as float) } + - { to_type: Numeric, expr: new Float(-0.0f) } + - { to_type: Object, expr: new Float(+0.0f) } + - { to_type: Comparable, expr: new Float(+0.0f) } - from_type: Double values: - { to_type: Floating, expr: new Double(Byte.MIN_VALUE.toDouble()) } - - { to_type: Numeric, expr: new Double(-0.0 as float) } - - { to_type: Object, expr: new Double(+0.0 as float) } - - { to_type: Comparable, expr: new Double(+0.0 as float) } + - { to_type: Numeric, expr: new Double(-0.0f) } + - { to_type: Object, expr: new Double(+0.0f) } + - { to_type: Comparable, expr: new Double(+0.0f) } - from_type: Char values: diff --git a/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/05.widening_reference_conversions/call_lmbd/call-lmbd.params.yaml b/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/05.widening_reference_conversions/call_lmbd/call-lmbd.params.yaml index 9020a840ef..d2c5245cd2 100644 --- a/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/05.widening_reference_conversions/call_lmbd/call-lmbd.params.yaml +++ b/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/05.widening_reference_conversions/call_lmbd/call-lmbd.params.yaml @@ -44,16 +44,16 @@ cases: - from_type: Float values: - { to_type: Floating, expr: new Float(Byte.MIN_VALUE.toFloat()) } - - { to_type: Numeric, expr: new Float(-0.0 as float) } - - { to_type: Object, expr: new Float(+0.0 as float) } - - { to_type: Comparable, expr: new Float(+0.0 as float) } + - { to_type: Numeric, expr: new Float(-0.0f) } + - { to_type: Object, expr: new Float(+0.0f) } + - { to_type: Comparable, expr: new Float(+0.0f) } - from_type: Double values: - { to_type: Floating, expr: new Double(Byte.MIN_VALUE.toDouble()) } - - { to_type: Numeric, expr: new Double(-0.0 as float) } - - { to_type: Object, expr: new Double(+0.0 as float) } - - { to_type: Comparable, expr: new Double(+0.0 as float) } + - { to_type: Numeric, expr: new Double(-0.0f) } + - { to_type: Object, expr: new Double(+0.0f) } + - { to_type: Comparable, expr: new Double(+0.0f) } - from_type: Char values: diff --git a/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/05.widening_reference_conversions/call_meth/call-meth.params.yaml b/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/05.widening_reference_conversions/call_meth/call-meth.params.yaml index 9020a840ef..d2c5245cd2 100644 --- a/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/05.widening_reference_conversions/call_meth/call-meth.params.yaml +++ b/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/05.widening_reference_conversions/call_meth/call-meth.params.yaml @@ -44,16 +44,16 @@ cases: - from_type: Float values: - { to_type: Floating, expr: new Float(Byte.MIN_VALUE.toFloat()) } - - { to_type: Numeric, expr: new Float(-0.0 as float) } - - { to_type: Object, expr: new Float(+0.0 as float) } - - { to_type: Comparable, expr: new Float(+0.0 as float) } + - { to_type: Numeric, expr: new Float(-0.0f) } + - { to_type: Object, expr: new Float(+0.0f) } + - { to_type: Comparable, expr: new Float(+0.0f) } - from_type: Double values: - { to_type: Floating, expr: new Double(Byte.MIN_VALUE.toDouble()) } - - { to_type: Numeric, expr: new Double(-0.0 as float) } - - { to_type: Object, expr: new Double(+0.0 as float) } - - { to_type: Comparable, expr: new Double(+0.0 as float) } + - { to_type: Numeric, expr: new Double(-0.0f) } + - { to_type: Object, expr: new Double(+0.0f) } + - { to_type: Comparable, expr: new Double(+0.0f) } - from_type: Char values: diff --git a/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/05.widening_reference_conversions/comp_arr/comp-arr.params.yaml b/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/05.widening_reference_conversions/comp_arr/comp-arr.params.yaml index 1643b2e0c0..823ec86789 100644 --- a/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/05.widening_reference_conversions/comp_arr/comp-arr.params.yaml +++ b/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/05.widening_reference_conversions/comp_arr/comp-arr.params.yaml @@ -44,16 +44,16 @@ cases: - from_type: Float values: - { to_type: Floating, expr: new Float(Byte.MIN_VALUE.toFloat()) } - - { to_type: Numeric, expr: new Float(-0.0 as float) } - - { to_type: Object, expr: new Float(+0.0 as float) } - - { to_type: Comparable, expr: new Float(+0.0 as float) } + - { to_type: Numeric, expr: new Float(-0.0f) } + - { to_type: Object, expr: new Float(+0.0f) } + - { to_type: Comparable, expr: new Float(+0.0f) } - from_type: Double values: - { to_type: Floating, expr: new Double(Byte.MIN_VALUE.toDouble()) } - - { to_type: Numeric, expr: new Double(-0.0 as float) } - - { to_type: Object, expr: new Double(+0.0 as float) } - - { to_type: Comparable, expr: new Double(+0.0 as float) } + - { to_type: Numeric, expr: new Double(-0.0f) } + - { to_type: Object, expr: new Double(+0.0f) } + - { to_type: Comparable, expr: new Double(+0.0f) } - from_type: Char values: diff --git a/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/05.widening_reference_conversions/comp_obj/comp-clss.params.yaml b/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/05.widening_reference_conversions/comp_obj/comp-clss.params.yaml index 0551a42405..9013b34247 100644 --- a/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/05.widening_reference_conversions/comp_obj/comp-clss.params.yaml +++ b/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/05.widening_reference_conversions/comp_obj/comp-clss.params.yaml @@ -44,16 +44,16 @@ cases: - from_type: Float values: - { to_type: Floating, init_value: 0.0, expr: new Float(Byte.MIN_VALUE.toFloat()) } - - { to_type: Numeric, init_value: 0, expr: new Float(-0.0 as float) } - - { to_type: Object, init_value: new Object(), expr: new Float(+0.0 as float) } - - { to_type: Comparable, init_value: new Float(), expr: new Float(+0.0 as float) } + - { to_type: Numeric, init_value: 0, expr: new Float(-0.0f) } + - { to_type: Object, init_value: new Object(), expr: new Float(+0.0f) } + - { to_type: Comparable, init_value: new Float(), expr: new Float(+0.0f) } - from_type: Double values: - { to_type: Floating, init_value: 0.0, expr: new Double(Byte.MIN_VALUE.toDouble()) } - - { to_type: Numeric, init_value: 0, expr: new Double(-0.0 as float) } - - { to_type: Object, init_value: new Object(), expr: new Double(+0.0 as float) } - - { to_type: Comparable, init_value: new Double(), expr: new Double(+0.0 as float) } + - { to_type: Numeric, init_value: 0, expr: new Double(-0.0f) } + - { to_type: Object, init_value: new Object(), expr: new Double(+0.0f) } + - { to_type: Comparable, init_value: new Double(), expr: new Double(+0.0f) } - from_type: Char values: diff --git a/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/05.widening_reference_conversions/comp_obj/comp-intf.params.yaml b/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/05.widening_reference_conversions/comp_obj/comp-intf.params.yaml index 9020a840ef..d2c5245cd2 100644 --- a/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/05.widening_reference_conversions/comp_obj/comp-intf.params.yaml +++ b/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/05.widening_reference_conversions/comp_obj/comp-intf.params.yaml @@ -44,16 +44,16 @@ cases: - from_type: Float values: - { to_type: Floating, expr: new Float(Byte.MIN_VALUE.toFloat()) } - - { to_type: Numeric, expr: new Float(-0.0 as float) } - - { to_type: Object, expr: new Float(+0.0 as float) } - - { to_type: Comparable, expr: new Float(+0.0 as float) } + - { to_type: Numeric, expr: new Float(-0.0f) } + - { to_type: Object, expr: new Float(+0.0f) } + - { to_type: Comparable, expr: new Float(+0.0f) } - from_type: Double values: - { to_type: Floating, expr: new Double(Byte.MIN_VALUE.toDouble()) } - - { to_type: Numeric, expr: new Double(-0.0 as float) } - - { to_type: Object, expr: new Double(+0.0 as float) } - - { to_type: Comparable, expr: new Double(+0.0 as float) } + - { to_type: Numeric, expr: new Double(-0.0f) } + - { to_type: Object, expr: new Double(+0.0f) } + - { to_type: Comparable, expr: new Double(+0.0f) } - from_type: Char values: diff --git a/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/05.widening_reference_conversions/decl_const/decl-const.params.yaml b/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/05.widening_reference_conversions/decl_const/decl-const.params.yaml index 2894b66feb..fafee067ee 100644 --- a/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/05.widening_reference_conversions/decl_const/decl-const.params.yaml +++ b/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/05.widening_reference_conversions/decl_const/decl-const.params.yaml @@ -44,9 +44,9 @@ cases: - from_type: Float values: - { to_type: Floating, expr: new Float(Byte.MIN_VALUE.toFloat()) } - - { to_type: Numeric, expr: new Float(-0.0 as float) } - - { to_type: Object, expr: new Float(+0.0 as float) } - - { to_type: Comparable, expr: new Float(+0.0 as float) } + - { to_type: Numeric, expr: new Float(-0.0f) } + - { to_type: Object, expr: new Float(+0.0f) } + - { to_type: Comparable, expr: new Float(+0.0f) } - from_type: Double values: diff --git a/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/05.widening_reference_conversions/decl_field/decl-field.params.yaml b/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/05.widening_reference_conversions/decl_field/decl-field.params.yaml index 2894b66feb..fafee067ee 100644 --- a/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/05.widening_reference_conversions/decl_field/decl-field.params.yaml +++ b/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/05.widening_reference_conversions/decl_field/decl-field.params.yaml @@ -44,9 +44,9 @@ cases: - from_type: Float values: - { to_type: Floating, expr: new Float(Byte.MIN_VALUE.toFloat()) } - - { to_type: Numeric, expr: new Float(-0.0 as float) } - - { to_type: Object, expr: new Float(+0.0 as float) } - - { to_type: Comparable, expr: new Float(+0.0 as float) } + - { to_type: Numeric, expr: new Float(-0.0f) } + - { to_type: Object, expr: new Float(+0.0f) } + - { to_type: Comparable, expr: new Float(+0.0f) } - from_type: Double values: diff --git a/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/05.widening_reference_conversions/decl_var/decl-var.params.yaml b/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/05.widening_reference_conversions/decl_var/decl-var.params.yaml index 6df5339c54..e3ee088930 100644 --- a/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/05.widening_reference_conversions/decl_var/decl-var.params.yaml +++ b/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/05.implicit_conversions/05.widening_reference_conversions/decl_var/decl-var.params.yaml @@ -44,9 +44,9 @@ cases: - from_type: Float values: - { to_type: Floating, expr: new Float(Byte.MIN_VALUE.toFloat()) } - - { to_type: Numeric, expr: new Float(-0.0 as float) } - - { to_type: Object, expr: new Float(+0.0 as float) } - - { to_type: Comparable, expr: new Float(+0.0 as float) } + - { to_type: Numeric, expr: new Float(-0.0f) } + - { to_type: Object, expr: new Float(+0.0f) } + - { to_type: Comparable, expr: new Float(+0.0f) } - from_type: Double values: diff --git a/static_core/plugins/ets/tests/ets_func_tests/escompat/ArrayTestDerived.ets b/static_core/plugins/ets/tests/ets_func_tests/escompat/ArrayTestDerived.ets index 26c1fbf143..6c52f9fc79 100644 --- a/static_core/plugins/ets/tests/ets_func_tests/escompat/ArrayTestDerived.ets +++ b/static_core/plugins/ets/tests/ets_func_tests/escompat/ArrayTestDerived.ets @@ -41,14 +41,14 @@ function __noinline__atOutside(a: Array) { function main(): int { let a = new Derived(10); for (let i = 0; i < 10; i++) { - a[i] = i as number; + a[i] = i.toDouble(); } arktest.assertEQ(__noinline__getOutside(a), DERIVED_ACCESS_OFFSET); arktest.assertEQ(__noinline__atOutside(a), DERIVED_ACCESS_OFFSET); let b = new Array(10); for (let i = 0; i < 10; i++) { - b[i] = i as number; + b[i] = i.toDouble(); } arktest.assertEQ(__noinline__getOutside(b), 0); arktest.assertEQ(__noinline__atOutside(b), 0); diff --git a/static_core/plugins/ets/tests/ets_func_tests/regression/16657.ets b/static_core/plugins/ets/tests/ets_func_tests/regression/16657.ets index e4ab7e7bf5..9ff3883cb7 100644 --- a/static_core/plugins/ets/tests/ets_func_tests/regression/16657.ets +++ b/static_core/plugins/ets/tests/ets_func_tests/regression/16657.ets @@ -29,9 +29,9 @@ class TimeAnimationImpl { } } -function smoothAnimation(period: int, from: float = 0.0 as float, to: float = 0.0 as float): TimeAnimationImpl { +function smoothAnimation(period: int, from: float = 0.0f, to: float = 0.0f): TimeAnimationImpl { if (!isFinite(period) || (period < 1)) throw new Error("illegal period: " + period) - return new TimeAnimationImpl((time:long): float => (1 - Math.cos(time / period * Math.PI) as float) / 2 * (to - from) + from) + return new TimeAnimationImpl((time:long): float => (1 - Math.cos(time / period * Math.PI).toFloat()) / 2 * (to - from) + from) } diff --git a/static_core/plugins/ets/tests/ets_func_tests/spec/15.Semantic_Rules/Compatibility_Features/Extended_Conditional_Expressions/numeric/expr/numeric-float-nonzero-expression.ets b/static_core/plugins/ets/tests/ets_func_tests/spec/15.Semantic_Rules/Compatibility_Features/Extended_Conditional_Expressions/numeric/expr/numeric-float-nonzero-expression.ets index e827135d63..d256003109 100644 --- a/static_core/plugins/ets/tests/ets_func_tests/spec/15.Semantic_Rules/Compatibility_Features/Extended_Conditional_Expressions/numeric/expr/numeric-float-nonzero-expression.ets +++ b/static_core/plugins/ets/tests/ets_func_tests/spec/15.Semantic_Rules/Compatibility_Features/Extended_Conditional_Expressions/numeric/expr/numeric-float-nonzero-expression.ets @@ -20,7 +20,7 @@ tags: [] function main() : int { - let nonZeroNumber: float = 1.0 as float; + let nonZeroNumber: float = 1.0f; if (nonZeroNumber) { return 0; } else { diff --git a/static_core/plugins/ets/tests/ets_func_tests/spec/15.Semantic_Rules/Compatibility_Features/Extended_Conditional_Expressions/numeric/expr/numeric-float-nonzero-ternary-operator-expression.ets b/static_core/plugins/ets/tests/ets_func_tests/spec/15.Semantic_Rules/Compatibility_Features/Extended_Conditional_Expressions/numeric/expr/numeric-float-nonzero-ternary-operator-expression.ets index ee29c15f4d..b15f3a7381 100644 --- a/static_core/plugins/ets/tests/ets_func_tests/spec/15.Semantic_Rules/Compatibility_Features/Extended_Conditional_Expressions/numeric/expr/numeric-float-nonzero-ternary-operator-expression.ets +++ b/static_core/plugins/ets/tests/ets_func_tests/spec/15.Semantic_Rules/Compatibility_Features/Extended_Conditional_Expressions/numeric/expr/numeric-float-nonzero-ternary-operator-expression.ets @@ -20,7 +20,7 @@ tags: [] function main(): int { - let nonZero: float = 1.0 as float; + let nonZero: float = 1.0f; let result = nonZero ? 0 : 1; return result; } diff --git a/static_core/plugins/ets/tests/ets_func_tests/spec/15.Semantic_Rules/Compatibility_Features/Extended_Conditional_Expressions/numeric/expr/numeric-float-zero-epsilon-expression.ets b/static_core/plugins/ets/tests/ets_func_tests/spec/15.Semantic_Rules/Compatibility_Features/Extended_Conditional_Expressions/numeric/expr/numeric-float-zero-epsilon-expression.ets index c1457ef1a5..d47c13a937 100644 --- a/static_core/plugins/ets/tests/ets_func_tests/spec/15.Semantic_Rules/Compatibility_Features/Extended_Conditional_Expressions/numeric/expr/numeric-float-zero-epsilon-expression.ets +++ b/static_core/plugins/ets/tests/ets_func_tests/spec/15.Semantic_Rules/Compatibility_Features/Extended_Conditional_Expressions/numeric/expr/numeric-float-zero-epsilon-expression.ets @@ -20,7 +20,7 @@ tags: [] function main() : int { - let epsilon: float = (0.0 as float) + Float.EPSILON; + let epsilon: float = (0.0f) + Float.EPSILON; if (epsilon) { return 0 } else { diff --git a/static_core/plugins/ets/tests/ets_func_tests/spec/15.Semantic_Rules/Compatibility_Features/Extended_Conditional_Expressions/numeric/expr/numeric-float-zero-expression.ets b/static_core/plugins/ets/tests/ets_func_tests/spec/15.Semantic_Rules/Compatibility_Features/Extended_Conditional_Expressions/numeric/expr/numeric-float-zero-expression.ets index 40e7d77117..094070865d 100644 --- a/static_core/plugins/ets/tests/ets_func_tests/spec/15.Semantic_Rules/Compatibility_Features/Extended_Conditional_Expressions/numeric/expr/numeric-float-zero-expression.ets +++ b/static_core/plugins/ets/tests/ets_func_tests/spec/15.Semantic_Rules/Compatibility_Features/Extended_Conditional_Expressions/numeric/expr/numeric-float-zero-expression.ets @@ -20,7 +20,7 @@ tags: [] function main() : int { - let zeroNumber: float = 0.0 as float; + let zeroNumber: float = 0.0f; if (zeroNumber) { return 1; } else { diff --git a/static_core/plugins/ets/tests/ets_func_tests/spec/15.Semantic_Rules/Compatibility_Features/Extended_Conditional_Expressions/numeric/expr/numeric-float-zero-object-expression.ets b/static_core/plugins/ets/tests/ets_func_tests/spec/15.Semantic_Rules/Compatibility_Features/Extended_Conditional_Expressions/numeric/expr/numeric-float-zero-object-expression.ets index 7eb27e07e6..fd7507a44a 100644 --- a/static_core/plugins/ets/tests/ets_func_tests/spec/15.Semantic_Rules/Compatibility_Features/Extended_Conditional_Expressions/numeric/expr/numeric-float-zero-object-expression.ets +++ b/static_core/plugins/ets/tests/ets_func_tests/spec/15.Semantic_Rules/Compatibility_Features/Extended_Conditional_Expressions/numeric/expr/numeric-float-zero-object-expression.ets @@ -20,7 +20,7 @@ tags: [] function main() : int { - let zeroNumber: Float = new Float(0.0 as float); + let zeroNumber: Float = new Float(0.0f); if (zeroNumber) { return 1; } else { diff --git a/static_core/plugins/ets/tests/ets_func_tests/spec/15.Semantic_Rules/Compatibility_Features/Extended_Conditional_Expressions/numeric/expr/numeric-float-zero-ternary-operator-expression.ets b/static_core/plugins/ets/tests/ets_func_tests/spec/15.Semantic_Rules/Compatibility_Features/Extended_Conditional_Expressions/numeric/expr/numeric-float-zero-ternary-operator-expression.ets index 7b425d3e4d..8c08c72887 100644 --- a/static_core/plugins/ets/tests/ets_func_tests/spec/15.Semantic_Rules/Compatibility_Features/Extended_Conditional_Expressions/numeric/expr/numeric-float-zero-ternary-operator-expression.ets +++ b/static_core/plugins/ets/tests/ets_func_tests/spec/15.Semantic_Rules/Compatibility_Features/Extended_Conditional_Expressions/numeric/expr/numeric-float-zero-ternary-operator-expression.ets @@ -20,7 +20,7 @@ tags: [] function main(): int { - let zeroNumber: float = 0 as float; + let zeroNumber: float = 0.0f; let result = zeroNumber ? 1 : 0; return result; } diff --git a/static_core/plugins/ets/tests/ets_func_tests/spec/15.Semantic_Rules/Compatibility_Features/Extended_Conditional_Expressions/numeric/loop/numeric-loop-do-while-float-in.ets b/static_core/plugins/ets/tests/ets_func_tests/spec/15.Semantic_Rules/Compatibility_Features/Extended_Conditional_Expressions/numeric/loop/numeric-loop-do-while-float-in.ets index a1ebafd472..0fe480c565 100644 --- a/static_core/plugins/ets/tests/ets_func_tests/spec/15.Semantic_Rules/Compatibility_Features/Extended_Conditional_Expressions/numeric/loop/numeric-loop-do-while-float-in.ets +++ b/static_core/plugins/ets/tests/ets_func_tests/spec/15.Semantic_Rules/Compatibility_Features/Extended_Conditional_Expressions/numeric/loop/numeric-loop-do-while-float-in.ets @@ -20,7 +20,7 @@ tags: [] function main(): int { - let nonZeroNumber: float = 1.0 as float; + let nonZeroNumber: float = 1.0f; let counter : int = 0; do { counter = counter + 1; diff --git a/static_core/plugins/ets/tests/ets_func_tests/spec/15.Semantic_Rules/Compatibility_Features/Extended_Conditional_Expressions/numeric/loop/numeric-loop-do-while-float.ets b/static_core/plugins/ets/tests/ets_func_tests/spec/15.Semantic_Rules/Compatibility_Features/Extended_Conditional_Expressions/numeric/loop/numeric-loop-do-while-float.ets index 825bc2e9c1..a7b8c98e7d 100644 --- a/static_core/plugins/ets/tests/ets_func_tests/spec/15.Semantic_Rules/Compatibility_Features/Extended_Conditional_Expressions/numeric/loop/numeric-loop-do-while-float.ets +++ b/static_core/plugins/ets/tests/ets_func_tests/spec/15.Semantic_Rules/Compatibility_Features/Extended_Conditional_Expressions/numeric/loop/numeric-loop-do-while-float.ets @@ -20,7 +20,7 @@ tags: [] function main(): int { - let zeroNumber: float = 0.0 as float; + let zeroNumber: float = 0.0f; let counter : int = 0; do { counter = counter + 1; diff --git a/static_core/plugins/ets/tests/ets_func_tests/spec/15.Semantic_Rules/Compatibility_Features/Extended_Conditional_Expressions/numeric/loop/numeric-loop-while-float-in.ets b/static_core/plugins/ets/tests/ets_func_tests/spec/15.Semantic_Rules/Compatibility_Features/Extended_Conditional_Expressions/numeric/loop/numeric-loop-while-float-in.ets index 76d74a6b56..582b0d84ec 100644 --- a/static_core/plugins/ets/tests/ets_func_tests/spec/15.Semantic_Rules/Compatibility_Features/Extended_Conditional_Expressions/numeric/loop/numeric-loop-while-float-in.ets +++ b/static_core/plugins/ets/tests/ets_func_tests/spec/15.Semantic_Rules/Compatibility_Features/Extended_Conditional_Expressions/numeric/loop/numeric-loop-while-float-in.ets @@ -20,7 +20,7 @@ tags: [] function main(): int { - let nonZeroNumber: float = 1.0 as float; + let nonZeroNumber: float = 1.0f; let counter : int = 0; while(nonZeroNumber) { counter = counter + 1; diff --git a/static_core/plugins/ets/tests/ets_func_tests/spec/15.Semantic_Rules/Compatibility_Features/Extended_Conditional_Expressions/numeric/loop/numeric-loop-while-float.ets b/static_core/plugins/ets/tests/ets_func_tests/spec/15.Semantic_Rules/Compatibility_Features/Extended_Conditional_Expressions/numeric/loop/numeric-loop-while-float.ets index 14905a3fcc..0bf1267d54 100644 --- a/static_core/plugins/ets/tests/ets_func_tests/spec/15.Semantic_Rules/Compatibility_Features/Extended_Conditional_Expressions/numeric/loop/numeric-loop-while-float.ets +++ b/static_core/plugins/ets/tests/ets_func_tests/spec/15.Semantic_Rules/Compatibility_Features/Extended_Conditional_Expressions/numeric/loop/numeric-loop-while-float.ets @@ -20,7 +20,7 @@ tags: [] function main(): int { - let zeroNumber: float = 0.0 as float; + let zeroNumber: float = 0.0f; let counter : int = 0; while(zeroNumber) { counter = counter + 1; diff --git a/static_core/plugins/ets/tests/ets_func_tests/std/core/TypeCreateInterfaceTest.ets b/static_core/plugins/ets/tests/ets_func_tests/std/core/TypeCreateInterfaceTest.ets index c8d0fd4084..1a53895dc4 100644 --- a/static_core/plugins/ets/tests/ets_func_tests/std/core/TypeCreateInterfaceTest.ets +++ b/static_core/plugins/ets/tests/ets_func_tests/std/core/TypeCreateInterfaceTest.ets @@ -28,7 +28,7 @@ class C implements I1, I2 { function getIfaces(): (InterfaceType | undefined)[] { const c = Type.of(new C()) as ClassType - let n = c.getInterfacesNum() as int + let n = c.getInterfacesNum().toInt() let r = new (InterfaceType | undefined)[n] for (let i = 0; i < n; i++) { r[i] = c.getInterface(i) diff --git a/static_core/plugins/ets/tests/ets_sdk/api/@ohos/buffer/BufferTests.ets b/static_core/plugins/ets/tests/ets_sdk/api/@ohos/buffer/BufferTests.ets index 19093c07f8..3fce1a56a0 100644 --- a/static_core/plugins/ets/tests/ets_sdk/api/@ohos/buffer/BufferTests.ets +++ b/static_core/plugins/ets/tests/ets_sdk/api/@ohos/buffer/BufferTests.ets @@ -529,35 +529,35 @@ function testWrite0009() { function testfrom0792() { let ab = new ArrayBuffer(100); - let buf = buffer.from(ab, 1.2 as int, 1.2 as int); + let buf = buffer.from(ab, (1.2).toInt(), (1.2).toInt()); let res = buf.toString('hex'); arktest.assertEQ(res, '00'); } function testfrom0793() { let ab = new ArrayBuffer(100); - let buf = buffer.from(ab, 1, 1.2 as int); + let buf = buffer.from(ab, 1, (1.2).toInt()); let res = buf.toString('hex'); arktest.assertEQ(res, '00'); } function testfrom0794() { let ab = new ArrayBuffer(100); - let buf = buffer.from(ab, 1.2 as int, 1); + let buf = buffer.from(ab, (1.2).toInt(), 1); let res = buf.toString('hex'); arktest.assertEQ(res, '00'); } function testfrom0795() { let ab = new ArrayBuffer(100); - let buf = buffer.from(ab, 9.9 as int, 9.9 as int); + let buf = buffer.from(ab, (9.9).toInt(), (9.9).toInt()); let res = buf.toString('hex'); arktest.assertEQ(res, '000000000000000000'); } function testfrom0796() { let ab = new ArrayBuffer(100); - let buf = buffer.from(ab, 2.9 as int , 2.9 as int); + let buf = buffer.from(ab, (2.9).toInt() , (2.9).toInt()); let res = buf.toString('hex'); arktest.assertEQ(res, '0000'); } diff --git a/static_core/plugins/ets/tests/ets_sdk/api/@ohos/util/PlainArray/PlainArrayForEachIteratorTests.ets b/static_core/plugins/ets/tests/ets_sdk/api/@ohos/util/PlainArray/PlainArrayForEachIteratorTests.ets index a154c491ff..dd0b5b5c1d 100644 --- a/static_core/plugins/ets/tests/ets_sdk/api/@ohos/util/PlainArray/PlainArrayForEachIteratorTests.ets +++ b/static_core/plugins/ets/tests/ets_sdk/api/@ohos/util/PlainArray/PlainArrayForEachIteratorTests.ets @@ -68,7 +68,7 @@ function testForEachWithOneParameter() { function testForEachWithTwoParameters() { let plainArray = new PlainArray(); for (let i: int = 0; i < TestData.forNumber2.length; i++) { - plainArray.add(TestData.forNumber2[i] as int, TestData.forNumber2[i]); + plainArray.add(TestData.forNumber2[i].toInt(), TestData.forNumber2[i]); } let forEachCount: int = 0; plainArray.forEach((value: double, index: int) => { diff --git a/static_core/plugins/ets/tests/ets_sdk/api/@ohos/util/PlainArray/PlainArrayForEachTest.ets b/static_core/plugins/ets/tests/ets_sdk/api/@ohos/util/PlainArray/PlainArrayForEachTest.ets index 8d4d421a1f..2dccffa053 100644 --- a/static_core/plugins/ets/tests/ets_sdk/api/@ohos/util/PlainArray/PlainArrayForEachTest.ets +++ b/static_core/plugins/ets/tests/ets_sdk/api/@ohos/util/PlainArray/PlainArrayForEachTest.ets @@ -86,7 +86,7 @@ function testSymbolIteratorWithStringValues() { let iter = plainArray.$_iterator(); let temp: IteratorResult<[Int, string]> = iter.next(); while (!temp.done) { - let key = temp.value![0] as double; + let key = temp.value![0].toDouble(); let value = temp.value![1] as string; arktest.assertEQ(plainArray.get(key.toInt()), value); temp = iter.next(); @@ -102,7 +102,7 @@ function testSymbolIteratorWithDuplicateStringValues() { let iter = plainArray.$_iterator(); let temp: IteratorResult<[Int, string]> = iter.next(); while (!temp.done) { - let key = temp.value![0] as double; + let key = temp.value![0].toDouble(); let value = temp.value![1] as string; arktest.assertEQ(plainArray.get(key.toInt()), value); temp = iter.next(); @@ -115,7 +115,7 @@ function testSymbolIteratorWithEmptyArray() { let iter = plainArray.$_iterator(); let temp: IteratorResult<[Int, string]> = iter.next(); while (!temp.done) { - let key = temp.value![0] as double; + let key = temp.value![0].toDouble(); let value = temp.value![1] as string; arktest.assertEQ(plainArray.get(key.toInt()), value); temp = iter.next(); diff --git a/static_core/plugins/ets/tests/ets_sdk/api/@ohos/xml/XmlSerializer/XmlSerializerSetAttributesTest.ets b/static_core/plugins/ets/tests/ets_sdk/api/@ohos/xml/XmlSerializer/XmlSerializerSetAttributesTest.ets index 4d38332f65..c213b6364a 100644 --- a/static_core/plugins/ets/tests/ets_sdk/api/@ohos/xml/XmlSerializer/XmlSerializerSetAttributesTest.ets +++ b/static_core/plugins/ets/tests/ets_sdk/api/@ohos/xml/XmlSerializer/XmlSerializerSetAttributesTest.ets @@ -43,7 +43,7 @@ function main(): int { function performXmlTest( setupCallback: (serializer: xml.XmlSerializer) => void, expectedXml: string, - bufferSize: number = MaxBufferLength + bufferSize: number = MaxBufferLength.toDouble() ): void { const arrayBuffer = new ArrayBuffer(bufferSize); const serializer = new xml.XmlSerializer(arrayBuffer); diff --git a/static_core/plugins/ets/tests/ets_test_suite/gc/stress/test_gc_old.ets b/static_core/plugins/ets/tests/ets_test_suite/gc/stress/test_gc_old.ets index f1edc5f019..9e08dc3d23 100644 --- a/static_core/plugins/ets/tests/ets_test_suite/gc/stress/test_gc_old.ets +++ b/static_core/plugins/ets/tests/ets_test_suite/gc/stress/test_gc_old.ets @@ -24,7 +24,7 @@ class TreeNode { class Random { public nextInt(n: int): int { - return (random() * n) as int; + return (random() * n).toInt(); } } @@ -55,7 +55,7 @@ class TestGCOld { private static rnd = new Random(); private static init() : void { - let ntrees : int = ((TestGCOld.size * TestGCOld.MEG) / TestGCOld.treeSize) as int; + let ntrees : int = ((TestGCOld.size * TestGCOld.MEG) / TestGCOld.treeSize).toInt(); TestGCOld.trees = new (TreeNode | undefined)[ntrees]; console.println("Allocating " + ntrees + " trees."); @@ -115,7 +115,7 @@ class TestGCOld { TestGCOld.doAllocateForYoungGen(n, TestGCOld.WORDS_DEAD); TestGCOld.runMutation(n); TestGCOld.doAllocateForOldGen(n / TestGCOld.promoteRate); - TestGCOld.runMutationForOldGen(max(0, (mutations + TestGCOld.ptrMutRate) - TestGCOld.actuallyMut) as long); + TestGCOld.runMutationForOldGen(max(0, (mutations + TestGCOld.ptrMutRate) - TestGCOld.actuallyMut).toLong()); } private static doAllocateForYoungGen(n : long, nwords : int) : void { @@ -136,7 +136,7 @@ class TestGCOld { } private static doAllocateForOldGen(n : long) : void { - let full : int = (n / TestGCOld.treeSize) as int; + let full : int = (n / TestGCOld.treeSize).toInt(); let partial : long = n % TestGCOld.treeSize; for (let i : int = 0; i < full; i++) { @@ -159,8 +159,8 @@ class TestGCOld { } private static swapSubtreesForOldGen() : void { - let index1 : int = TestGCOld.rnd.nextInt(TestGCOld.trees.length as int); - let index2 : int = TestGCOld.rnd.nextInt(TestGCOld.trees.length as int); + let index1 : int = TestGCOld.rnd.nextInt(TestGCOld.trees.length.toInt()); + let index2 : int = TestGCOld.rnd.nextInt(TestGCOld.trees.length.toInt()); let depth : int = TestGCOld.rnd.nextInt(TestGCOld.treeHeight); let path : int = TestGCOld.rnd.nextInt(TestGCOld.treeHeight); let tn1 : TreeNode | undefined = TestGCOld.trees[index1]; @@ -234,23 +234,23 @@ class TestGCOld { console.println("Initialization complete..."); - let start : long = Date.now() as long; + let start : long = Date.now().toLong(); for(let step = 0; step < TestGCOld.steps; step++) { TestGCOld.executeStep(TestGCOld.MEG); } - let end : long = Date.now() as long; - let secs : float = ((end-start)/1000.0) as float; + let end : long = Date.now().toLong(); + let secs : float = ((end-start)/1000.0).toFloat(); console.println("\nTook " + secs + " sec in steady state."); console.println("Allocated " + TestGCOld.steps + " Mb of young gen garbage" - + " (= " + (TestGCOld.steps/secs) as float + " Mb/sec)"); - console.println(" (actually allocated " + (TestGCOld.youngBytes/TestGCOld.MEG) as float + " megabytes)"); - let promoted : float = (TestGCOld.steps / TestGCOld.promoteRate) as float; + + " (= " + (TestGCOld.steps/secs).toFloat() + " Mb/sec)"); + console.println(" (actually allocated " + (TestGCOld.youngBytes/TestGCOld.MEG).toFloat() + " megabytes)"); + let promoted : float = (TestGCOld.steps / TestGCOld.promoteRate).toFloat(); console.println("Promoted " + promoted + - " Mb (= " + (promoted/secs) as float + " Mb/sec)"); - console.println(" (actually promoted " + ((TestGCOld.nodes * TestGCOld.BYTES_PER_NODE)/TestGCOld.MEG) as float + " megabytes)"); + " Mb (= " + (promoted/secs).toFloat() + " Mb/sec)"); + console.println(" (actually promoted " + ((TestGCOld.nodes * TestGCOld.BYTES_PER_NODE)/TestGCOld.MEG).toFloat() + " megabytes)"); if (TestGCOld.ptrMutRate != 0) { console.println("Mutated " + TestGCOld.actuallyMut + " pointers (= " + TestGCOld.actuallyMut/secs + " ptrs/sec)"); diff --git a/static_core/plugins/ets/tests/stdlib-templates/spec/expressions/equality/equality_primitive_01.ets b/static_core/plugins/ets/tests/stdlib-templates/spec/expressions/equality/equality_primitive_01.ets index 7cd7345952..4c37953d02 100644 --- a/static_core/plugins/ets/tests/stdlib-templates/spec/expressions/equality/equality_primitive_01.ets +++ b/static_core/plugins/ets/tests/stdlib-templates/spec/expressions/equality/equality_primitive_01.ets @@ -16,13 +16,13 @@ {% for item in equality_primitive_01 %} /*--- -desc: {function: {{.item.type1}}_equal_{{.item.type2}}} +desc: {function: {{.item.type1|lower}}_equal_{{.item.type2|lower}}} tags: [] ---*/ function main(): void { - let left: {{.item.type1}} = {{.item.value1}} as {{.item.type1}} - let right: {{.item.type2}} = {{.item.value2}} as {{.item.type2}} + let left: {{.item.type1}} = ({{.item.value1}}).to{%if item.type1 == 'number'%}Double{%else%}{{.item.type1}}{%endif%}() + let right: {{.item.type2}} = ({{.item.value2}}).to{%if item.type2 == 'number'%}Double{%else%}{{.item.type2}}{%endif%}() let result1: boolean = left == right let result2: boolean = left === right arktest.assertEQ(result1, result2) diff --git a/static_core/plugins/ets/tests/stdlib-templates/spec/expressions/equality/list.equality_primitive_01.yaml b/static_core/plugins/ets/tests/stdlib-templates/spec/expressions/equality/list.equality_primitive_01.yaml index 1cb3eb2aff..3ddb0066bf 100644 --- a/static_core/plugins/ets/tests/stdlib-templates/spec/expressions/equality/list.equality_primitive_01.yaml +++ b/static_core/plugins/ets/tests/stdlib-templates/spec/expressions/equality/list.equality_primitive_01.yaml @@ -13,45 +13,45 @@ # Compare floats - { - type1: "float", value1: "10.0", - type2: "float", value2: "2.3", + type1: "Float", value1: "10.0", + type2: "Float", value2: "2.3", result: "false" } - { - type1: "float", value1: "10.0", - type2: "float", value2: "10.0", + type1: "Float", value1: "10.0", + type2: "Float", value2: "10.0", result: "true" } - { - type1: "float", value1: "3.14157", - type2: "float", value2: "3.14157", + type1: "Float", value1: "3.14157", + type2: "Float", value2: "3.14157", result: "true" } - { - type1: "float", value1: "3.14157", - type2: "float", value2: "3.14158", + type1: "Float", value1: "3.14157", + type2: "Float", value2: "3.14158", result: "false" } # Compare doubles - { - type1: "double", value1: "10.0", - type2: "double", value2: "2.3", + type1: "Double", value1: "10.0", + type2: "Double", value2: "2.3", result: "false" } - { - type1: "double", value1: "10.0", - type2: "double", value2: "10.0", + type1: "Double", value1: "10.0", + type2: "Double", value2: "10.0", result: "true" } - { - type1: "double", value1: "3.14157", - type2: "double", value2: "3.14157", + type1: "Double", value1: "3.14157", + type2: "Double", value2: "3.14157", result: "true" } - { - type1: "double", value1: "3.14157", - type2: "double", value2: "3.14158", + type1: "Double", value1: "3.14157", + type2: "Double", value2: "3.14158", result: "false" } @@ -94,48 +94,48 @@ # Compare longs - { - type1: "long", value1: "1234567890", - type2: "long", value2: "1234567891", + type1: "Long", value1: "1234567890", + type2: "Long", value2: "1234567891", result: "false" } - { - type1: "long", value1: "1234567890", - type2: "long", value2: "1234567890", + type1: "Long", value1: "1234567890", + type2: "Long", value2: "1234567890", result: "true" } # Compare ints - { - type1: "int", value1: "65535", - type2: "int", value2: "65534", + type1: "Int", value1: "65535", + type2: "Int", value2: "65534", result: "false" } - { - type1: "int", value1: "65535", - type2: "int", value2: "65535", + type1: "Int", value1: "65535", + type2: "Int", value2: "65535", result: "true" } # Compare shorts - { - type1: "short", value1: "1024", - type2: "short", value2: "1025", + type1: "Short", value1: "1024", + type2: "Short", value2: "1025", result: "false" } - { - type1: "short", value1: "1024", - type2: "short", value2: "1024", + type1: "Short", value1: "1024", + type2: "Short", value2: "1024", result: "true" } # Compare bytes - { - type1: "byte", value1: "255", - type2: "byte", value2: "254", + type1: "Byte", value1: "255", + type2: "Byte", value2: "254", result: "false" } - { - type1: "byte", value1: "255", - type2: "byte", value2: "255", + type1: "Byte", value1: "255", + type2: "Byte", value2: "255", result: "true" } diff --git a/static_core/plugins/ets/tests/stdlib-templates/std/core/list.std_core_type_array_type.yaml b/static_core/plugins/ets/tests/stdlib-templates/std/core/list.std_core_type_array_type.yaml index 6ff6800966..0d0886ea82 100644 --- a/static_core/plugins/ets/tests/stdlib-templates/std/core/list.std_core_type_array_type.yaml +++ b/static_core/plugins/ets/tests/stdlib-templates/std/core/list.std_core_type_array_type.yaml @@ -43,7 +43,7 @@ } - { name: float, - init_value: "0.0 as float", + init_value: "0.0f", array_sizes: {1, 2, 10, 100}, } - { diff --git a/static_core/plugins/ets/tests/stdlib-templates/std/core/list.std_core_value.yaml b/static_core/plugins/ets/tests/stdlib-templates/std/core/list.std_core_value.yaml index 5492ad023e..b6040dfa72 100644 --- a/static_core/plugins/ets/tests/stdlib-templates/std/core/list.std_core_value.yaml +++ b/static_core/plugins/ets/tests/stdlib-templates/std/core/list.std_core_value.yaml @@ -49,7 +49,7 @@ } - { name: float, - init_values: {"0.0f", "1.0 as float", "-1.0 as float", "Float.MIN_VALUE as float", "Float.MAX_VALUE as float"}, + init_values: {"0.0f", "1.0f", "-1.0f", "Float.MIN_VALUE", "Float.MAX_VALUE"}, value_name: Float, primitive: true } @@ -97,7 +97,7 @@ } - { name: Float, - init_values: {"Float.valueOf(0.0 as float)", "Float.valueOf(1.0 as float)", "Float.valueOf(-1.0 as float)", "Float.valueOf(Float.MIN_VALUE as float)", "Float.valueOf(Float.MAX_VALUE as float)"}, + init_values: {"Float.valueOf(0.0f)", "Float.valueOf(1.0f)", "Float.valueOf(-1.0f)", "Float.valueOf(Float.MIN_VALUE)", "Float.valueOf(Float.MAX_VALUE)"}, value_name: Float, primitive: false } @@ -199,7 +199,7 @@ } - { name: "FixedArray", - init_values: {"[Float.valueOf(0.0 as float)] as FixedArray", "[Float.valueOf(0.0 as float), Float.valueOf(1.0 as float), Float.valueOf(-1.0 as float), Float.valueOf(Float.MIN_VALUE as float), Float.valueOf(Float.MAX_VALUE as float)] as FixedArray"}, + init_values: {"[Float.valueOf(0.0f)] as FixedArray", "[Float.valueOf(0.0f), Float.valueOf(1.0f), Float.valueOf(-1.0f), Float.valueOf(Float.MIN_VALUE), Float.valueOf(Float.MAX_VALUE)] as FixedArray"}, value_name: Array, primitive: false } diff --git a/static_core/plugins/ets/tests/stdlib-templates/std/serialization/list.std_serialization_json_static.yaml b/static_core/plugins/ets/tests/stdlib-templates/std/serialization/list.std_serialization_json_static.yaml index 29c7d64833..265c0854d0 100644 --- a/static_core/plugins/ets/tests/stdlib-templates/std/serialization/list.std_serialization_json_static.yaml +++ b/static_core/plugins/ets/tests/stdlib-templates/std/serialization/list.std_serialization_json_static.yaml @@ -111,8 +111,8 @@ method_test_index_data: {test1: {d: 1}, test2: {d: -1}, test3: {d: 0}, - test4: {d: 2.72182 as float}, - test5: {d: -2.72182 as float}, + test4: {d: 2.72182f}, + test5: {d: -2.72182f}, }, method_expected_data: {test1 : '"1"', test2: '"-1"', diff --git a/static_core/plugins/ets/tests/stdlib-templates/utils/test_core_typedarray_methods.j2 b/static_core/plugins/ets/tests/stdlib-templates/utils/test_core_typedarray_methods.j2 index fe97184ec1..1d809d9817 100644 --- a/static_core/plugins/ets/tests/stdlib-templates/utils/test_core_typedarray_methods.j2 +++ b/static_core/plugins/ets/tests/stdlib-templates/utils/test_core_typedarray_methods.j2 @@ -1690,7 +1690,7 @@ const testTypedArrayLastIndexOf = parametrize