From e97e122b9d2db70f6e43de99599395f5537b35ed Mon Sep 17 00:00:00 2001 From: xingzeng Date: Fri, 5 Sep 2025 16:32:51 +0800 Subject: [PATCH] Remove unboxed method for Built-In Type Classes Issue: https://gitee.com/openharmony/arkcompiler_runtime_core/issues/ICVOSZ Reason: The es2panda front-en emits toByte&co instead of unboxed in lowering. The public unboxed() method is slated for removal now that we don't have primitives at the language level. Meaning: Transfer from relying on primitive types to not relying on primitive types, with promise that in new language compiling framework it stiil can process type cast correctly. Signed-off-by: xingzeng --- .../ets/runtime/types/ets_typeapi_create.cpp | 24 +++- .../plugins/ets/sdk/native/api/Util.cpp | 2 +- .../plugins/ets/stdlib/escompat/Array.ets | 12 +- .../plugins/ets/stdlib/escompat/json.ets | 16 +-- .../plugins/ets/stdlib/std/core/Boolean.ets | 31 ++--- .../plugins/ets/stdlib/std/core/Byte.ets | 9 -- .../plugins/ets/stdlib/std/core/Char.ets | 11 +- .../plugins/ets/stdlib/std/core/Double.ets | 10 -- .../plugins/ets/stdlib/std/core/Float.ets | 11 +- .../plugins/ets/stdlib/std/core/Int.ets | 13 +- .../plugins/ets/stdlib/std/core/Long.ets | 13 +- .../plugins/ets/stdlib/std/core/Proxy.ets | 2 +- .../stdlib/std/core/ReadonlyArrayProxy.ets | 2 +- .../plugins/ets/stdlib/std/core/Runtime.ets | 4 +- .../plugins/ets/stdlib/std/core/Short.ets | 9 -- .../plugins/ets/stdlib/std/core/String.ets | 4 +- .../plugins/ets/stdlib/std/core/Void.ets | 2 - .../ets/templates/stdlib/Array_escompat.erb | 12 +- .../tests/any_ops/any_set_property_test.cpp | 2 +- .../ani/tests/array_ops/array_gtest_helper.h | 4 +- .../tuple_ops/tuplevalue_getitem_ref_test.cpp | 4 +- .../tests/checked/escape_analysis_casted.ets | 4 +- .../custom_literal_type.params.yaml | 4 +- .../17.array_types/object.params.yaml | 2 +- .../03.types/17.array_types/types.params.yaml | 4 +- .../array_nullable_types.params.yaml | 4 +- .../alias_conversion/assn_var/assn-var.ets | 2 +- .../call_cons/call-cons-nan.ets | 2 +- .../alias_conversion/call_cons/call-cons.ets | 2 +- .../call_func/call-func-nan.ets | 2 +- .../alias_conversion/call_func/call-func.ets | 2 +- .../call_lmbd/call-lmbd-nan.ets | 2 +- .../alias_conversion/call_lmbd/call-lmbd.ets | 2 +- .../call_meth/call-meth-nan.ets | 2 +- .../alias_conversion/call_meth/call-meth.ets | 2 +- .../comp_arr/comp-arr-nan.ets | 2 +- .../alias_conversion/comp_arr/comp-arr.ets | 2 +- .../comp_obj/comp-clss-nan.ets | 2 +- .../alias_conversion/comp_obj/comp-clss.ets | 2 +- .../comp_obj/comp-intf-nan.ets | 2 +- .../alias_conversion/comp_obj/comp-intf.ets | 2 +- .../decl_const/decl-const-nan.ets | 2 +- .../decl_const/decl-const.ets | 2 +- .../decl_field/decl-field-nan.ets | 2 +- .../decl_field/decl-field.ets | 2 +- .../alias_conversion/decl_var/decl-var.ets | 2 +- .../type_declaration_areas.params.yaml | 2 +- .../type_name_class_field.params.yaml | 126 ------------------ .../type_name_interface_prop.params.yaml | 111 +-------------- .../type_name_params.params.yaml | 76 +---------- .../alias.params.yaml | 20 +-- .../alias_gen.params.yaml | 8 +- .../var_decl.params.yaml | 2 +- .../infer.params.yaml | 13 -- .../02.parameter_list/param_list.params.yaml | 2 +- .../readonly_custom_neg.params.yaml | 2 +- .../ret_type_infer.params.yaml | 92 ------------- .../cce2.ets | 2 +- .../eval_decl.ets | 2 +- .../cond_f1.params.yaml | 14 +- .../if_f1.params.yaml | 14 +- .../if_t1.params.yaml | 12 +- .../for_of.params.yaml | 4 +- .../bt.ets | 2 +- .../bt_default.ets | 18 +-- .../bt_nan.ets | 2 +- .../assn_var/assn-var.ets | 2 +- .../call_cons/call-cons-nan.ets | 2 +- .../call_cons/call-cons.ets | 2 +- .../call_func/call-func-nan.ets | 2 +- .../call_func/call-func.ets | 2 +- .../call_lmbd/call-lmbd-nan.ets | 2 +- .../call_lmbd/call-lmbd.ets | 2 +- .../call_meth/call-meth-nan.ets | 2 +- .../call_meth/call-meth.ets | 2 +- .../comp_arr/comp-arr-nan.ets | 2 +- .../comp_arr/comp-arr.ets | 2 +- .../comp_obj/comp-clss-nan.ets | 2 +- .../comp_obj/comp-clss.ets | 2 +- .../comp_obj/comp-intf-nan.ets | 2 +- .../comp_obj/comp-intf.ets | 2 +- .../decl_const/decl-const-nan.ets | 2 +- .../decl_const/decl-const.ets | 2 +- .../decl_field/decl-field-nan.ets | 2 +- .../decl_field/decl-field.ets | 2 +- .../decl_var/decl-var.ets | 2 +- .../prim_boxing.ets | 2 +- .../prim_unboxing.ets | 2 +- .../identity.params.yaml | 4 - .../ets_func_tests/escompat/JsonTest.ets | 14 +- .../escompat/RegExpReplaceFunctionTest.ets | 14 +- .../ets_func_tests/std/core/DoubleTest.ets | 2 +- .../ets_func_tests/std/core/TypeFieldTest.ets | 2 +- .../tests/primitive/ts_to_ets/primitive.ets | 2 +- .../core/list.std_core_boolean_instance.yaml | 15 --- .../std/core/list.std_core_byte_instance.yaml | 14 -- .../std/core/list.std_core_char_instance.yaml | 19 +-- .../core/list.std_core_double_instance.yaml | 15 --- .../core/list.std_core_float_instance.yaml | 14 -- .../std/core/list.std_core_int_instance.yaml | 14 -- .../std/core/list.std_core_long_instance.yaml | 16 --- .../core/list.std_core_short_instance.yaml | 14 -- .../utils/test_constructor.j2 | 2 +- .../utils/test_verifier_lib.j2 | 2 +- .../verifier-tests/checkcast_null_acctype.pa | 4 +- 105 files changed, 198 insertions(+), 792 deletions(-) diff --git a/static_core/plugins/ets/runtime/types/ets_typeapi_create.cpp b/static_core/plugins/ets/runtime/types/ets_typeapi_create.cpp index 703a38239a..fc8debd894 100644 --- a/static_core/plugins/ets/runtime/types/ets_typeapi_create.cpp +++ b/static_core/plugins/ets/runtime/types/ets_typeapi_create.cpp @@ -229,7 +229,29 @@ const std::pair &TypeCreatorCtx::DeclarePrimitive(cons ctor.GetFn().metadata->SetAttribute(typeapi_create_consts::ATTR_CTOR); ctor.Create(); - PandasmMethodCreator unboxed {objectTypeName + ".unboxed", this}; + std::string rawTypeName {}; + if (primTypeName == "u1") { + rawTypeName = "Boolean"; + } else if (primTypeName == "i8") { + rawTypeName = "Byte"; + } else if (primTypeName == "i16") { + rawTypeName = "Short"; + } else if (primTypeName == "i32") { + rawTypeName = "Int"; + } else if (primTypeName == "i64") { + rawTypeName = "Long"; + } else if (primTypeName == "u16") { + rawTypeName = "Char"; + } else if (primTypeName == "void") { + rawTypeName = "Void"; + } else if (primTypeName == "f32") { + rawTypeName = "Float"; + } else if (primTypeName == "f64") { + rawTypeName = "Double"; + } else { + UNREACHABLE(); + } + PandasmMethodCreator unboxed {objectTypeName + ".to" + rawTypeName, this}; unboxed.AddParameter(objectType); unboxed.AddResult(primType); unboxed.GetFn().metadata->SetAttribute(typeapi_create_consts::ATTR_EXTERNAL); diff --git a/static_core/plugins/ets/sdk/native/api/Util.cpp b/static_core/plugins/ets/sdk/native/api/Util.cpp index 57b9c2cdc0..7287f65bd3 100644 --- a/static_core/plugins/ets/sdk/native/api/Util.cpp +++ b/static_core/plugins/ets/sdk/native/api/Util.cpp @@ -215,7 +215,7 @@ void ThrowBusinessError(ani_env *env, int code, const std::string &message) aniType UnboxTo##typeName(ani_env *env, ani_object value) \ { \ aniType result {}; \ - ANI_FATAL_IF_ERROR(env->Object_CallMethodByName_##typeName(value, "unboxed", ":" signature, &result)); \ + ANI_FATAL_IF_ERROR(env->Object_CallMethodByName_##typeName(value, "to##typeName", ":" signature, &result)); \ /* CC-OFFNXT(G.PRE.05) function defination, no effects */ \ return result; \ } diff --git a/static_core/plugins/ets/stdlib/escompat/Array.ets b/static_core/plugins/ets/stdlib/escompat/Array.ets index 75e87d56f4..8cf1163343 100644 --- a/static_core/plugins/ets/stdlib/escompat/Array.ets +++ b/static_core/plugins/ets/stdlib/escompat/Array.ets @@ -365,7 +365,7 @@ export class Array implements ReadonlyArray, Iterable { for (let i = fi; i < len; i++) { const tmp = this.$_get_unsafe(i) if (tmp instanceof Number) { - if (unboxedVal == tmp.unboxed()) { + if (unboxedVal == tmp) { return true } } @@ -375,12 +375,12 @@ export class Array implements ReadonlyArray, Iterable { } private searchFloat(val: Float, fi: int, len: int): boolean { - const unboxedVal: float = val.unboxed() + const unboxedVal: float = val if (isNaN(unboxedVal)) { for (let i = fi; i < len; i++) { const tmp = this.$_get_unsafe(i) if (tmp instanceof Float) { - if (isNaN(tmp.unboxed())) { + if (isNaN(tmp)) { return true } } @@ -389,7 +389,7 @@ export class Array implements ReadonlyArray, Iterable { for (let i = fi; i < len; i++) { const tmp = this.$_get_unsafe(i) if (tmp instanceof Float) { - if (unboxedVal == tmp.unboxed()) { + if (unboxedVal == tmp) { return true } } @@ -399,7 +399,7 @@ export class Array implements ReadonlyArray, Iterable { } private searchLong(val: Long, fi: int, len: int): boolean { - const unboxedVal: long = val.unboxed() + const unboxedVal: long = val for (let i = fi; i < len; i++) { const tmp = this.$_get_unsafe(i) if (tmp instanceof Long) { @@ -412,7 +412,7 @@ export class Array implements ReadonlyArray, Iterable { } private searchInt(val: Int, fi: int, len: int): boolean { - const unboxedVal: int = val.unboxed() + const unboxedVal: int = val for (let i = fi; i < len; i++) { const tmp = this.$_get_unsafe(i) if (tmp instanceof Int) { diff --git a/static_core/plugins/ets/stdlib/escompat/json.ets b/static_core/plugins/ets/stdlib/escompat/json.ets index b1b37e0479..0702826e24 100644 --- a/static_core/plugins/ets/stdlib/escompat/json.ets +++ b/static_core/plugins/ets/stdlib/escompat/json.ets @@ -1192,28 +1192,28 @@ class JSONWriter { private writeValueTypeWrapper(obj: Any): boolean { if (obj instanceof Boolean) { - this.buffer.append(JSON.stringify(obj.unboxed())) + this.buffer.append(JSON.stringify(obj.toBoolean())) return true } else if (obj instanceof Byte) { - this.buffer.append(JSON.stringify(obj.unboxed())) + this.buffer.append(JSON.stringify(obj.toByte())) return true } else if (obj instanceof Char) { - this.buffer.append(JSON.stringify(obj.unboxed())) + this.buffer.append(JSON.stringify(obj.toChar())) return true } else if (obj instanceof Short) { - this.buffer.append(JSON.stringify(obj.unboxed())) + this.buffer.append(JSON.stringify(obj.toShort())) return true } else if (obj instanceof Int) { - this.buffer.append(JSON.stringify(obj.unboxed())) + this.buffer.append(JSON.stringify(obj.toInt())) return true } else if (obj instanceof Long) { - this.buffer.append(JSON.stringify(obj.unboxed())) + this.buffer.append(JSON.stringify(obj.toLong())) return true } else if (obj instanceof Float) { - this.buffer.append(JSON.stringify(obj.unboxed())) + this.buffer.append(JSON.stringify(obj.toFloat())) return true } else if (obj instanceof Double) { - this.buffer.append(JSON.stringify(obj.unboxed())) + this.buffer.append(JSON.stringify(obj.toDouble())) return true } else if (obj instanceof BigInt) { this.buffer.append(JSON.stringify(obj)) diff --git a/static_core/plugins/ets/stdlib/std/core/Boolean.ets b/static_core/plugins/ets/stdlib/std/core/Boolean.ets index 97edf9ad6d..56ca0a3df9 100644 --- a/static_core/plugins/ets/stdlib/std/core/Boolean.ets +++ b/static_core/plugins/ets/stdlib/std/core/Boolean.ets @@ -121,21 +121,21 @@ export final class Boolean extends Object implements Comparable { if (value == null || value == undefined) { this.value = false; } else if (value instanceof Boolean) { - this.value = value.unboxed(); + this.value = value; } else if (value instanceof Number) { - this.value = (value.unboxed() != 0 && !isNaN(value.unboxed())); + this.value = (value != 0 && !isNaN(value)); } else if (value instanceof Char) { - this.value = value.unboxed() != c'\u0000'; + this.value = value != c'\u0000'; } else if (value instanceof Float) { - this.value = (value.unboxed() != 0.0 && !isNaN(value.unboxed())); + this.value = (value != 0.0 && !isNaN(value)); } else if (value instanceof Long) { - this.value = value.unboxed() != 0; + this.value = value != 0; } else if (value instanceof Int) { - this.value = value.unboxed() != 0; + this.value = value != 0; } else if (value instanceof Byte) { - this.value = value.unboxed() != 0; + this.value = value != 0; } else if (value instanceof Short) { - this.value = value.unboxed() != 0; + this.value = value != 0; } else if (value instanceof String) { this.value = value != ''; } else if (value instanceof Object) { @@ -167,15 +167,6 @@ export final class Boolean extends Object implements Comparable { return new Boolean(value).valueOf(); } - /** - * Returns the value of this instance as a primitive - * - * @returns primitive boolean value - */ - public unboxed(): boolean { - return this.value; - } - /** * Static instance that represents true boolean value */ @@ -312,7 +303,7 @@ export final class Boolean extends Object implements Comparable { * @returns value as a result of logical `and` */ public and(other: Boolean): Boolean { - return Boolean.valueOf(this.value && other.unboxed()) + return Boolean.valueOf(this.value && other) } /** @@ -323,7 +314,7 @@ export final class Boolean extends Object implements Comparable { * @returns value as a result of logical `or` */ public or(other: Boolean): Boolean { - return Boolean.valueOf(this.value || other.unboxed()) + return Boolean.valueOf(this.value || other) } /** @@ -334,6 +325,6 @@ export final class Boolean extends Object implements Comparable { * @returns value as a result of `xor` */ public xor(other: Boolean): Boolean { - return Boolean.valueOf(this.value ^ other.unboxed()) + return Boolean.valueOf(this.value ^ other) } } diff --git a/static_core/plugins/ets/stdlib/std/core/Byte.ets b/static_core/plugins/ets/stdlib/std/core/Byte.ets index 04ae55f57a..f72f677ae5 100644 --- a/static_core/plugins/ets/stdlib/std/core/Byte.ets +++ b/static_core/plugins/ets/stdlib/std/core/Byte.ets @@ -37,15 +37,6 @@ export final class Byte extends Integral implements Comparable { this.value = value; } - /** - * Returns value of this instance as a primitive - * - * @returns value of this instance - */ - public unboxed(): byte { - return this.value; - } - /** * Returns boxed representation of the primitive * diff --git a/static_core/plugins/ets/stdlib/std/core/Char.ets b/static_core/plugins/ets/stdlib/std/core/Char.ets index ebb4ea34b8..66c2b03051 100644 --- a/static_core/plugins/ets/stdlib/std/core/Char.ets +++ b/static_core/plugins/ets/stdlib/std/core/Char.ets @@ -39,15 +39,6 @@ export final class Char extends Object implements Comparable { this.value = value; } - /** - * unboxed() returns an underlying primitive char. - * - * @returns the underlying primitive char. - */ - public unboxed(): char { - return this.value; - } - /** * valueOf(char) creates a Char object from a primitive char. * This method is preferred over {@link } since this method can use a cached Char object, @@ -104,7 +95,7 @@ export final class Char extends Object implements Comparable { * @returns comparison result of the underlying chars. */ public static compare(lhs: Char, rhs: Char): boolean { - return (lhs.unboxed() == rhs.unboxed()); + return (lhs == rhs); } /** diff --git a/static_core/plugins/ets/stdlib/std/core/Double.ets b/static_core/plugins/ets/stdlib/std/core/Double.ets index 25383d943d..b3458dda85 100644 --- a/static_core/plugins/ets/stdlib/std/core/Double.ets +++ b/static_core/plugins/ets/stdlib/std/core/Double.ets @@ -82,16 +82,6 @@ export final class Double extends Floating implements Comparable { return new Double(NaN); } - /** - * Returns value of this instance as a primitive - * - * @returns value of this instance - * @tag arkts - */ - public unboxed(): double { - return this.value; - } - /** * Returns boxed representation of the primitive * diff --git a/static_core/plugins/ets/stdlib/std/core/Float.ets b/static_core/plugins/ets/stdlib/std/core/Float.ets index 4bb4106267..f86bf9491c 100644 --- a/static_core/plugins/ets/stdlib/std/core/Float.ets +++ b/static_core/plugins/ets/stdlib/std/core/Float.ets @@ -46,15 +46,6 @@ export final class Float extends Floating implements Comparable { this.value = Double.toFloat(value); } - /** - * Returns value of this instance as a primitive - * - * @returns value of this instance - */ - public unboxed(): float { - return this.value; - } - /** * Returns boxed representation of the primitive * @@ -312,7 +303,7 @@ export final class Float extends Floating implements Comparable { * @returns result of the comparison */ public override compareTo(other: Float): int { - return (this.value - other.unboxed()).toInt(); + return (this.value - other).toInt(); } /** diff --git a/static_core/plugins/ets/stdlib/std/core/Int.ets b/static_core/plugins/ets/stdlib/std/core/Int.ets index f74a1d0d0e..454b6c5ccd 100644 --- a/static_core/plugins/ets/stdlib/std/core/Int.ets +++ b/static_core/plugins/ets/stdlib/std/core/Int.ets @@ -37,15 +37,6 @@ export final class Int extends Integral implements Comparable { this.value = value; } - /** - * Returns value of this instance as a primitive - * - * @returns value of this instance - */ - public unboxed(): int { - return this.value; - } - /** * Returns boxed representation of the primitive * @@ -283,10 +274,10 @@ export final class Int extends Integral implements Comparable { * @returns result of the comparison */ public override compareTo(other: Int): int { - if (this.value < other.unboxed()) { + if (this.value < other) { return -1; } - if (this.value == other.unboxed()) { + if (this.value == other) { return 0; } return 1; diff --git a/static_core/plugins/ets/stdlib/std/core/Long.ets b/static_core/plugins/ets/stdlib/std/core/Long.ets index b197949eba..ab2e29bc12 100644 --- a/static_core/plugins/ets/stdlib/std/core/Long.ets +++ b/static_core/plugins/ets/stdlib/std/core/Long.ets @@ -37,15 +37,6 @@ export final class Long extends Integral implements Comparable { this.value = value; } - /** - * Returns value of this instance as a primitive - * - * @returns value of this instance - */ - public unboxed(): long { - return this.value; - } - /** * Returns boxed representation of the primitive * @@ -283,10 +274,10 @@ export final class Long extends Integral implements Comparable { * @returns result of the comparison */ public override compareTo(other: Long): int { - if (this.value < other.unboxed()) { + if (this.value < other) { return -1; } - if (this.value == other.unboxed()) { + if (this.value == other) { return 0; } return 1; diff --git a/static_core/plugins/ets/stdlib/std/core/Proxy.ets b/static_core/plugins/ets/stdlib/std/core/Proxy.ets index 10bb69dbda..8323af9a58 100644 --- a/static_core/plugins/ets/stdlib/std/core/Proxy.ets +++ b/static_core/plugins/ets/stdlib/std/core/Proxy.ets @@ -820,7 +820,7 @@ abstract class ArrayProxy extends Array { override get length(): int { const length = this.handlerGet(this.target, this.handler, ArrayProxy.LENGTH_PROP_NAME) if (length instanceof Int) { - return length.unboxed() + return length } throw new TypeError("unexpected Array.length value type: " + Type.of(length)) diff --git a/static_core/plugins/ets/stdlib/std/core/ReadonlyArrayProxy.ets b/static_core/plugins/ets/stdlib/std/core/ReadonlyArrayProxy.ets index c01a427194..11b8ccdb41 100644 --- a/static_core/plugins/ets/stdlib/std/core/ReadonlyArrayProxy.ets +++ b/static_core/plugins/ets/stdlib/std/core/ReadonlyArrayProxy.ets @@ -153,7 +153,7 @@ class ReadonlyArrayProxy implements ReadonlyArray { get length(): int { const length = this.handler.get(this.target, "length") if (length instanceof Int) { - return length.unboxed() + return length } throw new TypeError("unexpected ReadonlyArray.length value type: " + Type.of(length)) diff --git a/static_core/plugins/ets/stdlib/std/core/Runtime.ets b/static_core/plugins/ets/stdlib/std/core/Runtime.ets index 63bcf5fcdb..ac4fe32d48 100644 --- a/static_core/plugins/ets/stdlib/std/core/Runtime.ets +++ b/static_core/plugins/ets/stdlib/std/core/Runtime.ets @@ -83,8 +83,8 @@ export final class Runtime { } private static sameFloatValue(f1: Float, f2: Float): boolean { - const f1val = f1.unboxed() - const f2val = f2.unboxed() + const f1val = f1 + const f2val = f2 if (f1val == 0 || f2val == 0) { return Float.bitCastToInt(f1val) == Float.bitCastToInt(f2val) diff --git a/static_core/plugins/ets/stdlib/std/core/Short.ets b/static_core/plugins/ets/stdlib/std/core/Short.ets index de9c39e52d..4a06d59d8d 100644 --- a/static_core/plugins/ets/stdlib/std/core/Short.ets +++ b/static_core/plugins/ets/stdlib/std/core/Short.ets @@ -37,15 +37,6 @@ export final class Short extends Integral implements Comparable { this.value = value; } - /** - * Returns value of this instance as a primitive - * - * @returns value of this instance - */ - public unboxed(): short { - return this.value; - } - /** * Returns boxed representation of the primitive * diff --git a/static_core/plugins/ets/stdlib/std/core/String.ets b/static_core/plugins/ets/stdlib/std/core/String.ets index 34827095ad..32ef73021b 100644 --- a/static_core/plugins/ets/stdlib/std/core/String.ets +++ b/static_core/plugins/ets/stdlib/std/core/String.ets @@ -1580,7 +1580,7 @@ export final class String extends Object implements Comparable, Iterable let result = '' let arrayMatchPositions = matchPositions.toArray() for (let i = 0; i < arrayMatchPositions.length; ++i) { - let p = arrayMatchPositions[i].unboxed() + let p = arrayMatchPositions[i] let preserved = this.substring(endOfLastMatch, p) let replacement = String.getSubstitution(searchValue, this, p, new String[0], undefined, replaceValue) result = result + preserved + replacement @@ -1632,7 +1632,7 @@ export final class String extends Object implements Comparable, Iterable let result = '' let arrayMatchPositions = matchPositions.toArray() for (let i = 0; i < arrayMatchPositions.length; ++i) { - let p = arrayMatchPositions[i].unboxed() + let p = arrayMatchPositions[i] let preserved = this.substring(endOfLastMatch, p) let args = new containers.UndefinableObjectArray(2) args.pushBack(Double.valueOf(p)) diff --git a/static_core/plugins/ets/stdlib/std/core/Void.ets b/static_core/plugins/ets/stdlib/std/core/Void.ets index 8957f7e614..b74849f180 100644 --- a/static_core/plugins/ets/stdlib/std/core/Void.ets +++ b/static_core/plugins/ets/stdlib/std/core/Void.ets @@ -18,6 +18,4 @@ package std.core; export final class Void { static readonly void_instance = new Void(); private constructor() { } - - public unboxed(): void {} } diff --git a/static_core/plugins/ets/templates/stdlib/Array_escompat.erb b/static_core/plugins/ets/templates/stdlib/Array_escompat.erb index 2afd21bed8..7569c44b7f 100644 --- a/static_core/plugins/ets/templates/stdlib/Array_escompat.erb +++ b/static_core/plugins/ets/templates/stdlib/Array_escompat.erb @@ -344,7 +344,7 @@ export class Array implements ReadonlyArray, Iterable { for (let i = fi; i < len; i++) { const tmp = this.$_get_unsafe(i) if (tmp instanceof Number) { - if (unboxedVal == tmp.unboxed()) { + if (unboxedVal == tmp) { return true } } @@ -354,12 +354,12 @@ export class Array implements ReadonlyArray, Iterable { } private searchFloat(val: Float, fi: int, len: int): boolean { - const unboxedVal: float = val.unboxed() + const unboxedVal: float = val if (isNaN(unboxedVal)) { for (let i = fi; i < len; i++) { const tmp = this.$_get_unsafe(i) if (tmp instanceof Float) { - if (isNaN(tmp.unboxed())) { + if (isNaN(tmp)) { return true } } @@ -368,7 +368,7 @@ export class Array implements ReadonlyArray, Iterable { for (let i = fi; i < len; i++) { const tmp = this.$_get_unsafe(i) if (tmp instanceof Float) { - if (unboxedVal == tmp.unboxed()) { + if (unboxedVal == tmp) { return true } } @@ -378,7 +378,7 @@ export class Array implements ReadonlyArray, Iterable { } private searchLong(val: Long, fi: int, len: int): boolean { - const unboxedVal: long = val.unboxed() + const unboxedVal: long = val for (let i = fi; i < len; i++) { const tmp = this.$_get_unsafe(i) if (tmp instanceof Long) { @@ -391,7 +391,7 @@ export class Array implements ReadonlyArray, Iterable { } private searchInt(val: Int, fi: int, len: int): boolean { - const unboxedVal: int = val.unboxed() + const unboxedVal: int = val for (let i = fi; i < len; i++) { const tmp = this.$_get_unsafe(i) if (tmp instanceof Int) { diff --git a/static_core/plugins/ets/tests/ani/tests/any_ops/any_set_property_test.cpp b/static_core/plugins/ets/tests/ani/tests/any_ops/any_set_property_test.cpp index 188a1c438b..bc4c407ad7 100644 --- a/static_core/plugins/ets/tests/ani/tests/any_ops/any_set_property_test.cpp +++ b/static_core/plugins/ets/tests/ani/tests/any_ops/any_set_property_test.cpp @@ -92,7 +92,7 @@ TEST_F(AnySetPropertyTest, AnySetByIndex_Valid) ani_ref result {}; ASSERT_EQ(env_->Any_GetByIndex(arrayRef, 0U, &result), ANI_OK); ani_int intResult = 0; - ASSERT_EQ(env_->Object_CallMethodByName_Int(static_cast(result), "unboxed", nullptr, &intResult), + ASSERT_EQ(env_->Object_CallMethodByName_Int(static_cast(result), "toInt", nullptr, &intResult), ANI_OK); ASSERT_EQ(intResult, intValue); } diff --git a/static_core/plugins/ets/tests/ani/tests/array_ops/array_gtest_helper.h b/static_core/plugins/ets/tests/ani/tests/array_ops/array_gtest_helper.h index b426572727..48cf8d3e8d 100644 --- a/static_core/plugins/ets/tests/ani/tests/array_ops/array_gtest_helper.h +++ b/static_core/plugins/ets/tests/ani/tests/array_ops/array_gtest_helper.h @@ -32,8 +32,8 @@ public: env_->Class_FindMethod(intClass, "", "i:", &intCtor); ASSERT(booleanCtor != nullptr); ASSERT(intCtor != nullptr); - env_->Class_FindMethod(booleanClass, "unboxed", ":z", &booleanUnbox); - env_->Class_FindMethod(intClass, "unboxed", ":i", &intUnbox); + env_->Class_FindMethod(booleanClass, "toBoolean", ":z", &booleanUnbox); + env_->Class_FindMethod(intClass, "toInt", ":i", &intUnbox); ASSERT(booleanUnbox != nullptr); ASSERT(intUnbox != nullptr); } diff --git a/static_core/plugins/ets/tests/ani/tests/tuple_ops/tuplevalue_getitem_ref_test.cpp b/static_core/plugins/ets/tests/ani/tests/tuple_ops/tuplevalue_getitem_ref_test.cpp index 73afed6a06..b831b87101 100644 --- a/static_core/plugins/ets/tests/ani/tests/tuple_ops/tuplevalue_getitem_ref_test.cpp +++ b/static_core/plugins/ets/tests/ani/tests/tuple_ops/tuplevalue_getitem_ref_test.cpp @@ -57,7 +57,7 @@ protected: ASSERT_EQ(env_->FindClass("std.core.Double", &doubleClass), ANI_OK); ASSERT(doubleClass != nullptr); ani_method doubleUnbox; - env_->Class_FindMethod(doubleClass, "unboxed", ":d", &doubleUnbox); + env_->Class_FindMethod(doubleClass, "toDouble", ":d", &doubleUnbox); ASSERT(doubleClass != nullptr); ani_ref result {}; @@ -149,7 +149,7 @@ TEST_F(TupleValueGetItemRefTest, tupleValueGetItemIntCompositeScene) ASSERT_EQ(env_->FindClass("std.core.Double", &doubleClass), ANI_OK); ASSERT(doubleClass != nullptr); ani_method doubleUnbox; - env_->Class_FindMethod(doubleClass, "unboxed", ":d", &doubleUnbox); + env_->Class_FindMethod(doubleClass, "toDouble", ":d", &doubleUnbox); ASSERT(doubleClass != nullptr); ASSERT_EQ(env_->TupleValue_GetItem_Ref(tuple, 1U, &result), ANI_OK); diff --git a/static_core/plugins/ets/tests/checked/escape_analysis_casted.ets b/static_core/plugins/ets/tests/checked/escape_analysis_casted.ets index 2fbb3bba1a..d58fa0dafa 100644 --- a/static_core/plugins/ets/tests/checked/escape_analysis_casted.ets +++ b/static_core/plugins/ets/tests/checked/escape_analysis_casted.ets @@ -46,7 +46,7 @@ class A { let s: byte = -128 as byte; function main_char(): int { - let c: char = new A(s).fld.unboxed(); + let c: char = new A(s).fld.toChar(); if (c != c'\uFF80') { return 1; } @@ -90,7 +90,7 @@ class B { let b: int = (1 << 17) + (1 << 8) + 1; function main_long(): int { - let c: char = new B(b).fld.unboxed(); + let c: char = new B(b).fld.toChar(); if (c != c'\u0001') { return 1; } diff --git a/static_core/plugins/ets/tests/ets-templates/03.types/16.literal_types/custom_literal_type.params.yaml b/static_core/plugins/ets/tests/ets-templates/03.types/16.literal_types/custom_literal_type.params.yaml index 1a2784da1c..15fd106c74 100644 --- a/static_core/plugins/ets/tests/ets-templates/03.types/16.literal_types/custom_literal_type.params.yaml +++ b/static_core/plugins/ets/tests/ets-templates/03.types/16.literal_types/custom_literal_type.params.yaml @@ -32,7 +32,7 @@ cases: a = "another str" arktest.assertEQ( a, "another str" ) a = new Number(3) - arktest.assertEQ( a.unboxed(), 3 ) + arktest.assertEQ( a.toDouble(), 3 ) a = "str" arktest.assertEQ( a, "str" ) a = true @@ -49,7 +49,7 @@ cases: a = "another str" arktest.assertEQ( a, "another str" ) a = new Number(3) - arktest.assertEQ( a.unboxed(), 3 ) + arktest.assertEQ( a.toDouble(), 3 ) a = "str" arktest.assertEQ( a, "str" ) a = true diff --git a/static_core/plugins/ets/tests/ets-templates/03.types/17.array_types/object.params.yaml b/static_core/plugins/ets/tests/ets-templates/03.types/17.array_types/object.params.yaml index 53412c81f9..1fe25a3d79 100644 --- a/static_core/plugins/ets/tests/ets-templates/03.types/17.array_types/object.params.yaml +++ b/static_core/plugins/ets/tests/ets-templates/03.types/17.array_types/object.params.yaml @@ -29,7 +29,7 @@ cases: assert: '[0] == Color.Red' # reference types - - { type: 'Byte[]', vals: '[new Byte(127 as byte), new Byte(2 as byte), new Byte(1 as byte)]', assert: '[0].unboxed() == 127' } + - { type: 'Byte[]', vals: '[new Byte(127 as byte), new Byte(2 as byte), new Byte(1 as byte)]', assert: '[0].toByte() == 127' } - { type: 'Error[]', vals: '[new Error("A"), new Error("B"), new Error("C")]', assert: '[0].message == "A"' } - { type: 'string[][]', vals: 'new string[2][2]; arr[1][1] = "ABC"', assert: '[1][1] == "ABC"' } - decl: |- diff --git a/static_core/plugins/ets/tests/ets-templates/03.types/17.array_types/types.params.yaml b/static_core/plugins/ets/tests/ets-templates/03.types/17.array_types/types.params.yaml index 279ce94325..ab84c9ff6a 100644 --- a/static_core/plugins/ets/tests/ets-templates/03.types/17.array_types/types.params.yaml +++ b/static_core/plugins/ets/tests/ets-templates/03.types/17.array_types/types.params.yaml @@ -30,7 +30,7 @@ cases: assert: 'arr[0] == Color.Green' # reference types - - { type: 'Byte[]', vals: '[new Byte((127).toByte()), new Byte((2).toByte()), new Byte((1).toByte())]', val: new Byte((42).toByte()), assert: 'arr[0].unboxed() == 42' } + - { type: 'Byte[]', vals: '[new Byte((127).toByte()), new Byte((2).toByte()), new Byte((1).toByte())]', val: new Byte((42).toByte()), assert: 'arr[0].toByte() == 42' } - { type: 'Error[]', vals: '[new Error("A"), new Error("B"), new Error("C")]', val: new Error("D"), assert: 'arr[0].message == "D"' } # type aliases @@ -39,7 +39,7 @@ cases: type: A[] vals: 'new A[2]' val: 'new Boolean(true)' - assert: 'arr[0] instanceof Boolean && (arr[0] as Boolean).unboxed()' + assert: 'arr[0] instanceof Boolean && (arr[0] as Boolean).toBoolean()' - decl: |- type A = (Object|null)[] diff --git a/static_core/plugins/ets/tests/ets-templates/03.types/21.nullish_types/array_nullable_types.params.yaml b/static_core/plugins/ets/tests/ets-templates/03.types/21.nullish_types/array_nullable_types.params.yaml index 30045f8d75..3bc26bc318 100644 --- a/static_core/plugins/ets/tests/ets-templates/03.types/21.nullish_types/array_nullable_types.params.yaml +++ b/static_core/plugins/ets/tests/ets-templates/03.types/21.nullish_types/array_nullable_types.params.yaml @@ -40,7 +40,7 @@ nullables: type: 'Z[]' vals: '[undefined]' val: 'new Int(66)' - assert: 'x[0]!.unboxed() == 66' + assert: 'x[0]!.toInt() == 66' - decl: |- type Z = (Int | null)[] @@ -61,4 +61,4 @@ nullables: type: 'Z' vals: '[undefined]' val: 'new Int(66)' - assert: 'x[0]!.unboxed() == 66' + assert: 'x[0]!.toInt() == 66' diff --git a/static_core/plugins/ets/tests/ets-templates/03.types/alias_conversion/assn_var/assn-var.ets b/static_core/plugins/ets/tests/ets-templates/03.types/alias_conversion/assn_var/assn-var.ets index 02293176ff..f2e3cd65dc 100644 --- a/static_core/plugins/ets/tests/ets-templates/03.types/alias_conversion/assn_var/assn-var.ets +++ b/static_core/plugins/ets/tests/ets-templates/03.types/alias_conversion/assn_var/assn-var.ets @@ -26,7 +26,7 @@ function main(): int { {%- for t in c['values'] %} let s{{loop.index}}: {{c.from_type}} = {{t.expr|safe}} d{{loop.index}} = s{{loop.index}} - if (d{{loop.index}}.unboxed() != {{t.val}}) { + if (d{{loop.index}} != {{t.val}}) { return 1 } {%- endfor %} diff --git a/static_core/plugins/ets/tests/ets-templates/03.types/alias_conversion/call_cons/call-cons-nan.ets b/static_core/plugins/ets/tests/ets-templates/03.types/alias_conversion/call_cons/call-cons-nan.ets index 7c774728c3..8775af8bc2 100644 --- a/static_core/plugins/ets/tests/ets-templates/03.types/alias_conversion/call_cons/call-cons-nan.ets +++ b/static_core/plugins/ets/tests/ets-templates/03.types/alias_conversion/call_cons/call-cons-nan.ets @@ -27,7 +27,7 @@ class A { function main(): int { {%- for t in c['values'] %} let s{{loop.index}}: {{c.from_type}} = {{t.expr|safe}} - if (! {{c.to_type}}.isNaN(new A(s{{loop.index}}).f.unboxed())) { + if (! {{c.to_type}}.isNaN(new A(s{{loop.index}}).f)) { return 1 } {%- endfor %} diff --git a/static_core/plugins/ets/tests/ets-templates/03.types/alias_conversion/call_cons/call-cons.ets b/static_core/plugins/ets/tests/ets-templates/03.types/alias_conversion/call_cons/call-cons.ets index 2f7fc8ce75..cf3de2e1f5 100644 --- a/static_core/plugins/ets/tests/ets-templates/03.types/alias_conversion/call_cons/call-cons.ets +++ b/static_core/plugins/ets/tests/ets-templates/03.types/alias_conversion/call_cons/call-cons.ets @@ -27,7 +27,7 @@ class A { function main(): int { {%- for t in c['values'] %} let s{{loop.index}}: {{c.from_type}} = {{t.expr|safe}} - if (new A(s{{loop.index}}).f.unboxed() != {{t.val}}) { + if (new A(s{{loop.index}}).f != {{t.val}}) { return 1 } {%- endfor %} diff --git a/static_core/plugins/ets/tests/ets-templates/03.types/alias_conversion/call_func/call-func-nan.ets b/static_core/plugins/ets/tests/ets-templates/03.types/alias_conversion/call_func/call-func-nan.ets index 6d13560531..f8c17ed850 100644 --- a/static_core/plugins/ets/tests/ets-templates/03.types/alias_conversion/call_func/call-func-nan.ets +++ b/static_core/plugins/ets/tests/ets-templates/03.types/alias_conversion/call_func/call-func-nan.ets @@ -24,7 +24,7 @@ function foo(p: {{c.to_type}}): {{c.to_type}} { return p } function main(): int { {%- for t in c['values'] %} let s{{loop.index}}: {{c.from_type}} = {{t.expr|safe}} - if (! {{c.to_type}}.isNaN(foo(s{{loop.index}}).unboxed())) { + if (! {{c.to_type}}.isNaN(foo(s{{loop.index}}))) { return 1 } {%- endfor %} diff --git a/static_core/plugins/ets/tests/ets-templates/03.types/alias_conversion/call_func/call-func.ets b/static_core/plugins/ets/tests/ets-templates/03.types/alias_conversion/call_func/call-func.ets index c3cc3e149d..e192b82704 100644 --- a/static_core/plugins/ets/tests/ets-templates/03.types/alias_conversion/call_func/call-func.ets +++ b/static_core/plugins/ets/tests/ets-templates/03.types/alias_conversion/call_func/call-func.ets @@ -24,7 +24,7 @@ function foo(p: {{c.to_type}}): {{c.to_type}} { return p } function main(): int { {%- for t in c['values'] %} let s{{loop.index}}: {{c.from_type}} = {{t.expr|safe}} - if (foo(s{{loop.index}}).unboxed() != {{t.val}}) { + if (foo(s{{loop.index}}) != {{t.val}}) { return 1 } {%- endfor %} diff --git a/static_core/plugins/ets/tests/ets-templates/03.types/alias_conversion/call_lmbd/call-lmbd-nan.ets b/static_core/plugins/ets/tests/ets-templates/03.types/alias_conversion/call_lmbd/call-lmbd-nan.ets index f67a03c0c7..5bf1ca3f5c 100644 --- a/static_core/plugins/ets/tests/ets-templates/03.types/alias_conversion/call_lmbd/call-lmbd-nan.ets +++ b/static_core/plugins/ets/tests/ets-templates/03.types/alias_conversion/call_lmbd/call-lmbd-nan.ets @@ -22,7 +22,7 @@ params: NaN conversion from {{c.from_type}} to {{c.to_type}} function main(): int { {%- for t in c['values'] %} let s{{loop.index}}: {{c.from_type}} = {{t.expr|safe}} - if (! {{c.to_type}}.isNaN(((p: {{c.to_type}}): {{c.to_type}} => { return p })(s{{loop.index}}).unboxed())) { + if (! {{c.to_type}}.isNaN(((p: {{c.to_type}}): {{c.to_type}} => { return p })(s{{loop.index}}))) { return 1 } {%- endfor %} diff --git a/static_core/plugins/ets/tests/ets-templates/03.types/alias_conversion/call_lmbd/call-lmbd.ets b/static_core/plugins/ets/tests/ets-templates/03.types/alias_conversion/call_lmbd/call-lmbd.ets index 804c8e0aff..6ea6f761e0 100644 --- a/static_core/plugins/ets/tests/ets-templates/03.types/alias_conversion/call_lmbd/call-lmbd.ets +++ b/static_core/plugins/ets/tests/ets-templates/03.types/alias_conversion/call_lmbd/call-lmbd.ets @@ -22,7 +22,7 @@ params: from {{c.from_type}} to {{c.to_type}} function main(): int { {%- for t in c['values'] %} let s{{loop.index}}: {{c.from_type}} = {{t.expr|safe}} - if (((p: {{c.to_type}}): {{c.to_type}} => { return p })(s{{loop.index}}).unboxed() != {{t.val}}) { + if (((p: {{c.to_type}}): {{c.to_type}} => { return p })(s{{loop.index}}) != {{t.val}}) { return 1 } {%- endfor %} diff --git a/static_core/plugins/ets/tests/ets-templates/03.types/alias_conversion/call_meth/call-meth-nan.ets b/static_core/plugins/ets/tests/ets-templates/03.types/alias_conversion/call_meth/call-meth-nan.ets index 0236c2750a..9d775dbb43 100644 --- a/static_core/plugins/ets/tests/ets-templates/03.types/alias_conversion/call_meth/call-meth-nan.ets +++ b/static_core/plugins/ets/tests/ets-templates/03.types/alias_conversion/call_meth/call-meth-nan.ets @@ -27,7 +27,7 @@ function main(): int { let a: A = new A() {%- for t in c['values'] %} let s{{loop.index}}: {{c.from_type}} = {{t.expr|safe}} - if (! {{c.to_type}}.isNaN(a.meth(s{{loop.index}}).unboxed())) { + if (! {{c.to_type}}.isNaN(a.meth(s{{loop.index}}))) { return 1 } {%- endfor %} diff --git a/static_core/plugins/ets/tests/ets-templates/03.types/alias_conversion/call_meth/call-meth.ets b/static_core/plugins/ets/tests/ets-templates/03.types/alias_conversion/call_meth/call-meth.ets index be95b54ba7..0b8e1b769f 100644 --- a/static_core/plugins/ets/tests/ets-templates/03.types/alias_conversion/call_meth/call-meth.ets +++ b/static_core/plugins/ets/tests/ets-templates/03.types/alias_conversion/call_meth/call-meth.ets @@ -27,7 +27,7 @@ function main(): int { let a: A = new A() {%- for t in c['values'] %} let s{{loop.index}}: {{c.from_type}} = {{t.expr|safe}} - if (a.meth(s{{loop.index}}).unboxed() != {{t.val}}) { + if (a.meth(s{{loop.index}}) != {{t.val}}) { return 1 } {%- endfor %} diff --git a/static_core/plugins/ets/tests/ets-templates/03.types/alias_conversion/comp_arr/comp-arr-nan.ets b/static_core/plugins/ets/tests/ets-templates/03.types/alias_conversion/comp_arr/comp-arr-nan.ets index 9739e7a334..c3fa163279 100644 --- a/static_core/plugins/ets/tests/ets-templates/03.types/alias_conversion/comp_arr/comp-arr-nan.ets +++ b/static_core/plugins/ets/tests/ets-templates/03.types/alias_conversion/comp_arr/comp-arr-nan.ets @@ -27,7 +27,7 @@ function main(): int { let d{{loop.index}}: {{c.to_type}}[] = [s{{loop.index}}, s{{loop.index}}] d{{loop.index}} = [] d{{loop.index}} = [s{{loop.index}}] - if (! {{c.to_type}}.isNaN(d{{loop.index}}[0].unboxed())) { + if (! {{c.to_type}}.isNaN(d{{loop.index}}[0])) { return 1 } {%- endfor %} diff --git a/static_core/plugins/ets/tests/ets-templates/03.types/alias_conversion/comp_arr/comp-arr.ets b/static_core/plugins/ets/tests/ets-templates/03.types/alias_conversion/comp_arr/comp-arr.ets index deb2d8d195..a4ff54f3de 100644 --- a/static_core/plugins/ets/tests/ets-templates/03.types/alias_conversion/comp_arr/comp-arr.ets +++ b/static_core/plugins/ets/tests/ets-templates/03.types/alias_conversion/comp_arr/comp-arr.ets @@ -27,7 +27,7 @@ function main(): int { let d{{loop.index}}: {{c.to_type}}[] = [s{{loop.index}}, s{{loop.index}}] d{{loop.index}} = [] d{{loop.index}} = [s{{loop.index}}] - if (d{{loop.index}}[0].unboxed() != {{t.val}}) { + if (d{{loop.index}}[0] != {{t.val}}) { return 1 } {%- endfor %} diff --git a/static_core/plugins/ets/tests/ets-templates/03.types/alias_conversion/comp_obj/comp-clss-nan.ets b/static_core/plugins/ets/tests/ets-templates/03.types/alias_conversion/comp_obj/comp-clss-nan.ets index b789859c0c..b9687fb414 100644 --- a/static_core/plugins/ets/tests/ets-templates/03.types/alias_conversion/comp_obj/comp-clss-nan.ets +++ b/static_core/plugins/ets/tests/ets-templates/03.types/alias_conversion/comp_obj/comp-clss-nan.ets @@ -26,7 +26,7 @@ let s{{loop.index}}: {{c.from_type}} = {{t.expr|safe}}; function main(): int { {%- for t in c['values'] %} let d{{loop.index}}: A{{loop.index}} = { fld: s{{loop.index}} } - if (! {{c.to_type}}.isNaN(d{{loop.index}}.fld.unboxed())) { + if (! {{c.to_type}}.isNaN(d{{loop.index}}.fld)) { return 1 } {%- endfor %} diff --git a/static_core/plugins/ets/tests/ets-templates/03.types/alias_conversion/comp_obj/comp-clss.ets b/static_core/plugins/ets/tests/ets-templates/03.types/alias_conversion/comp_obj/comp-clss.ets index 0d89d12e5a..65c4e08a8f 100644 --- a/static_core/plugins/ets/tests/ets-templates/03.types/alias_conversion/comp_obj/comp-clss.ets +++ b/static_core/plugins/ets/tests/ets-templates/03.types/alias_conversion/comp_obj/comp-clss.ets @@ -26,7 +26,7 @@ let s{{loop.index}}: {{c.from_type}} = {{t.expr|safe}}; function main(): int { {%- for t in c['values'] %} let d{{loop.index}}: A{{loop.index}} = { fld: s{{loop.index}} } - if (d{{loop.index}}.fld.unboxed() != {{t.val}}) { + if (d{{loop.index}}.fld != {{t.val}}) { return 1 } {%- endfor %} diff --git a/static_core/plugins/ets/tests/ets-templates/03.types/alias_conversion/comp_obj/comp-intf-nan.ets b/static_core/plugins/ets/tests/ets-templates/03.types/alias_conversion/comp_obj/comp-intf-nan.ets index 4c2d8405e1..b40507a467 100644 --- a/static_core/plugins/ets/tests/ets-templates/03.types/alias_conversion/comp_obj/comp-intf-nan.ets +++ b/static_core/plugins/ets/tests/ets-templates/03.types/alias_conversion/comp_obj/comp-intf-nan.ets @@ -26,7 +26,7 @@ let s{{loop.index}}: {{c.from_type}} = {{t.expr|safe}}; function main(): int { {%- for t in c['values'] %} let d{{loop.index}}: J{{loop.index}} = { fld: s{{loop.index}} } - if (! {{c.to_type}}.isNaN(d{{loop.index}}.fld.unboxed())) { + if (! {{c.to_type}}.isNaN(d{{loop.index}}.fld)) { return 1 } {%- endfor %} diff --git a/static_core/plugins/ets/tests/ets-templates/03.types/alias_conversion/comp_obj/comp-intf.ets b/static_core/plugins/ets/tests/ets-templates/03.types/alias_conversion/comp_obj/comp-intf.ets index 3bd64f4cd9..2e271b8e70 100644 --- a/static_core/plugins/ets/tests/ets-templates/03.types/alias_conversion/comp_obj/comp-intf.ets +++ b/static_core/plugins/ets/tests/ets-templates/03.types/alias_conversion/comp_obj/comp-intf.ets @@ -26,7 +26,7 @@ let s{{loop.index}}: {{c.from_type}} = {{t.expr|safe}}; function main(): int { {%- for t in c['values'] %} let d{{loop.index}}: J{{loop.index}} = { fld: s{{loop.index}} } - if (d{{loop.index}}.fld.unboxed() != {{t.val}}) { + if (d{{loop.index}}.fld != {{t.val}}) { return 1 } {%- endfor %} diff --git a/static_core/plugins/ets/tests/ets-templates/03.types/alias_conversion/decl_const/decl-const-nan.ets b/static_core/plugins/ets/tests/ets-templates/03.types/alias_conversion/decl_const/decl-const-nan.ets index 1020699164..98968a9d41 100644 --- a/static_core/plugins/ets/tests/ets-templates/03.types/alias_conversion/decl_const/decl-const-nan.ets +++ b/static_core/plugins/ets/tests/ets-templates/03.types/alias_conversion/decl_const/decl-const-nan.ets @@ -23,7 +23,7 @@ function main(): int { {%- for t in c['values'] %} let s{{loop.index}}: {{c.from_type}} = {{t.expr|safe}} const d{{loop.index}}: {{c.to_type}} = s{{loop.index}} - if (! {{c.to_type}}.isNaN(d{{loop.index}}.unboxed())) { + if (! {{c.to_type}}.isNaN(d{{loop.index}})) { return 1 } {%- endfor %} diff --git a/static_core/plugins/ets/tests/ets-templates/03.types/alias_conversion/decl_const/decl-const.ets b/static_core/plugins/ets/tests/ets-templates/03.types/alias_conversion/decl_const/decl-const.ets index cae66a4f65..3373c05cae 100644 --- a/static_core/plugins/ets/tests/ets-templates/03.types/alias_conversion/decl_const/decl-const.ets +++ b/static_core/plugins/ets/tests/ets-templates/03.types/alias_conversion/decl_const/decl-const.ets @@ -23,7 +23,7 @@ function main(): int { {%- for t in c['values'] %} let s{{loop.index}}: {{c.from_type}} = {{t.expr|safe}} const d{{loop.index}}: {{c.to_type}} = s{{loop.index}} - if (d{{loop.index}}.unboxed() != {{t.val}}) { + if (d{{loop.index}} != {{t.val}}) { return 1 } {%- endfor %} diff --git a/static_core/plugins/ets/tests/ets-templates/03.types/alias_conversion/decl_field/decl-field-nan.ets b/static_core/plugins/ets/tests/ets-templates/03.types/alias_conversion/decl_field/decl-field-nan.ets index cb2ac512b6..e615efeace 100644 --- a/static_core/plugins/ets/tests/ets-templates/03.types/alias_conversion/decl_field/decl-field-nan.ets +++ b/static_core/plugins/ets/tests/ets-templates/03.types/alias_conversion/decl_field/decl-field-nan.ets @@ -29,7 +29,7 @@ class A{{loop.index}} { function main(): int { {%- for t in c['values'] %} let a{{loop.index}}: A{{loop.index}} = new A{{loop.index}}() - if (! {{c.to_type}}.isNaN(a{{loop.index}}.d.unboxed())) { + if (! {{c.to_type}}.isNaN(a{{loop.index}}.d)) { return 1 } {%- endfor %} diff --git a/static_core/plugins/ets/tests/ets-templates/03.types/alias_conversion/decl_field/decl-field.ets b/static_core/plugins/ets/tests/ets-templates/03.types/alias_conversion/decl_field/decl-field.ets index e09cec8e7c..47c3c04fa5 100644 --- a/static_core/plugins/ets/tests/ets-templates/03.types/alias_conversion/decl_field/decl-field.ets +++ b/static_core/plugins/ets/tests/ets-templates/03.types/alias_conversion/decl_field/decl-field.ets @@ -29,7 +29,7 @@ class A{{loop.index}} { function main(): int { {%- for t in c['values'] %} let a{{loop.index}}: A{{loop.index}} = new A{{loop.index}}() - if (a{{loop.index}}.d.unboxed() != {{t.val}}) { + if (a{{loop.index}}.d != {{t.val}}) { return 1 } {%- endfor %} diff --git a/static_core/plugins/ets/tests/ets-templates/03.types/alias_conversion/decl_var/decl-var.ets b/static_core/plugins/ets/tests/ets-templates/03.types/alias_conversion/decl_var/decl-var.ets index 5b21318981..589ec8a106 100644 --- a/static_core/plugins/ets/tests/ets-templates/03.types/alias_conversion/decl_var/decl-var.ets +++ b/static_core/plugins/ets/tests/ets-templates/03.types/alias_conversion/decl_var/decl-var.ets @@ -23,7 +23,7 @@ function main(): int { {%- for t in c['values'] %} let s{{loop.index}}: {{c.from_type}} = {{t.expr|safe}} let d{{loop.index}}: {{c.to_type}} = s{{loop.index}} - if (d{{loop.index}}.unboxed() != {{t.val}}) { + if (d{{loop.index}} != {{t.val}}) { return 1 } {%- endfor %} diff --git a/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/04.accessible/type_declaration_areas.params.yaml b/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/04.accessible/type_declaration_areas.params.yaml index 28559cc942..00aa6c163c 100644 --- a/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/04.accessible/type_declaration_areas.params.yaml +++ b/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/04.accessible/type_declaration_areas.params.yaml @@ -18,7 +18,7 @@ cases: let checked = false; { let a: A = new Boolean(true); - checked = a.unboxed(); + checked = a; } function main() { diff --git a/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/04.accessible/type_name_class_field.params.yaml b/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/04.accessible/type_name_class_field.params.yaml index e7b1b18224..2806f702e6 100644 --- a/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/04.accessible/type_name_class_field.params.yaml +++ b/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/04.accessible/type_name_class_field.params.yaml @@ -141,118 +141,6 @@ cases: } # Boxed - - decl: |- - type T = Byte - field: |- - foo: T = new Byte(0x7F.toByte()); - static sfoo: T = new Byte(0x7F.toByte()); - check: |- - function main() { - arktest.assertEQ(A.sfoo.unboxed(), 0x7F.toByte()); - let a: A = new A(); - arktest.assertEQ(a.foo.unboxed(), 0x7F.toByte()); - arktest.assertEQ(a.bar(a.foo).unboxed(), 0x7F.toByte()); - arktest.assertEQ(A.sbar(a.foo).unboxed(), 0x7F.toByte()); - } - - - decl: |- - type T = Short - field: |- - foo: T = new Short(2); - static sfoo: T = new Short(2); - check: |- - function main() { - arktest.assertEQ(A.sfoo.unboxed(), new Short(2)); - let a: A = new A(); - arktest.assertEQ(a.foo.unboxed(), new Short(2)); - arktest.assertEQ(a.bar(a.foo).unboxed(), new Short(2)); - arktest.assertEQ(A.sbar(a.foo).unboxed(), new Short(2)); - } - - - decl: |- - type T = Int - field: |- - foo: T = new Int(3); - static sfoo: T = new Int(3); - check: |- - function main() { - arktest.assertEQ(A.sfoo.unboxed(), new Int(3)); - let a: A = new A(); - arktest.assertEQ(a.foo.unboxed(), new Int(3)); - arktest.assertEQ(a.bar(a.foo).unboxed(), new Int(3)); - arktest.assertEQ(A.sbar(a.foo).unboxed(), new Int(3)); - } - - - decl: |- - type T = Long - field: |- - foo: T = new Long(4); - static sfoo: T = new Long(4); - check: |- - function main() { - arktest.assertEQ(A.sfoo.unboxed(), new Long(4)); - let a: A = new A(); - arktest.assertEQ(a.foo.unboxed(), new Long(4)); - arktest.assertEQ(a.bar(a.foo).unboxed(), new Long(4)); - arktest.assertEQ(A.sbar(a.foo).unboxed(), new Long(4)); - } - - - decl: |- - type T = Float - field: |- - foo: T = new Float(0.1); - static sfoo: T = new Float(0.1); - check: |- - function main() { - arktest.assertEQ(A.sfoo.unboxed(), new Float(0.1)); - let a: A = new A(); - arktest.assertEQ(a.foo.unboxed(), new Float(0.1)); - arktest.assertEQ(a.bar(a.foo).unboxed(), new Float(0.1)); - arktest.assertEQ(A.sbar(a.foo).unboxed(), new Float(0.1)); - } - - - decl: |- - type T = Double - field: |- - foo: T = new Double(0.1); - static sfoo: T = new Double(0.1); - check: |- - function main() { - arktest.assertEQ(A.sfoo.unboxed(), new Double(0.1)); - let a: A = new A(); - arktest.assertEQ(a.foo.unboxed(), new Double(0.1)); - arktest.assertEQ(a.bar(a.foo).unboxed(), new Double(0.1)); - arktest.assertEQ(A.sbar(a.foo).unboxed(), new Double(0.1)); - } - - - decl: |- - type T = Number - field: |- - foo: T = new Number(0.1 as number); - static sfoo: T = new Number(0.1 as number); - check: |- - function main() { - arktest.assertEQ(A.sfoo.unboxed(), 0.1 as number); - let a: A = new A(); - arktest.assertEQ(a.foo.unboxed(), 0.1 as number); - arktest.assertEQ(a.bar(a.foo).unboxed(), 0.1 as number); - arktest.assertEQ(A.sbar(a.foo).unboxed(), 0.1 as number); - } - - - decl: |- - type T = Char - field: |- - foo: T = new Char(c'b'); - static sfoo: T = new Char(c'b'); - check: |- - function main() { - arktest.assertEQ(A.sfoo.unboxed(), c'b'); - let a: A = new A(); - arktest.assertEQ(a.foo.unboxed(), c'b'); - arktest.assertEQ(a.bar(a.foo).unboxed(), c'b'); - arktest.assertEQ(A.sbar(a.foo).unboxed(), c'b'); - } - - decl: |- type T = string field: |- @@ -281,20 +169,6 @@ cases: arktest.assertEQ(A.sbar(a.foo), "some string"); } - - decl: |- - type T = Boolean - field: |- - foo: T = new Boolean(false); - static sfoo: T = new Boolean(true); - check: |- - function main() { - arktest.assertEQ(A.sfoo.unboxed(), true); - let a: A = new A(); - arktest.assertEQ(a.foo.unboxed(), false); - arktest.assertEQ(a.bar(A.sfoo).unboxed(), true); - arktest.assertEQ(A.sbar(a.foo).unboxed(), false); - } - # Custom - decl: |- type T = int[] diff --git a/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/04.accessible/type_name_interface_prop.params.yaml b/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/04.accessible/type_name_interface_prop.params.yaml index 059be7470b..36855ce89f 100644 --- a/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/04.accessible/type_name_interface_prop.params.yaml +++ b/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/04.accessible/type_name_interface_prop.params.yaml @@ -114,94 +114,6 @@ cases: } # Boxed - - decl: |- - type T = Byte - init: |- - foo = new Byte(0x7F.toByte()); - check: |- - function main() { - let a: A = new A(); - arktest.assertEQ(a.foo.unboxed(), 0x7F.toByte()); - arktest.assertEQ(a.bar(a.foo).unboxed(), 0x7F.toByte()); - } - - - decl: |- - type T = Short - init: |- - foo = new Short(2); - check: |- - function main() { - let a: A = new A(); - arktest.assertEQ(a.foo.unboxed(), new Short(2)); - arktest.assertEQ(a.bar(a.foo).unboxed(), new Short(2)); - } - - - decl: |- - type T = Int - init: |- - foo = new Int(3); - check: |- - function main() { - let a: A = new A(); - arktest.assertEQ(a.foo.unboxed(), new Int(3)); - arktest.assertEQ(a.bar(a.foo).unboxed(), new Int(3)); - } - - - decl: |- - type T = Long - init: |- - foo = new Long(4); - check: |- - function main() { - let a: A = new A(); - arktest.assertEQ(a.foo.unboxed(), new Long(4)); - arktest.assertEQ(a.bar(a.foo).unboxed(), new Long(4)); - } - - - decl: |- - type T = Float - init: |- - foo = new Float(0.1); - check: |- - function main() { - let a: A = new A(); - arktest.assertEQ(a.foo.unboxed(), new Float(0.1)); - arktest.assertEQ(a.bar(a.foo).unboxed(), new Float(0.1)); - } - - - decl: |- - type T = Double - init: |- - foo = new Double(0.1); - check: |- - function main() { - let a: A = new A(); - arktest.assertEQ(a.foo.unboxed(), new Double(0.1)); - arktest.assertEQ(a.bar(a.foo).unboxed(), new Double(0.1)); - } - - - decl: |- - type T = Number - init: |- - foo = new Number(0.1 as number); - check: |- - function main() { - let a: A = new A(); - arktest.assertEQ(a.foo.unboxed(), 0.1 as number); - arktest.assertEQ(a.bar(a.foo).unboxed(), 0.1 as number); - } - - - decl: |- - type T = Char - init: |- - foo = new Char(c'b'); - check: |- - function main() { - let a: A = new A(); - arktest.assertEQ(a.foo.unboxed(), c'b'); - arktest.assertEQ(a.bar(a.foo).unboxed(), c'b'); - } - - decl: |- type T = string init: |- @@ -224,17 +136,6 @@ cases: arktest.assertEQ(a.bar(a.foo), "some string"); } - - decl: |- - type T = Boolean - init: |- - foo = new Boolean(false); - check: |- - function main() { - let a: A = new A(); - arktest.assertEQ(a.foo.unboxed(), false); - arktest.assertEQ(a.bar(a.foo).unboxed(), false); - } - # Custom - decl: |- type T = int[] @@ -263,16 +164,16 @@ cases: arktest.assertEQ(a.foo.length, 2); arktest.assertEQ(a.foo[0].length, 2); arktest.assertEQ(a.foo[1].length, 1); - arktest.assertEQ(a.foo[0][0].unboxed(), 1); - arktest.assertEQ(a.foo[0][1].unboxed(), 3); - arktest.assertEQ(a.foo[1][0].unboxed(), -2); + arktest.assertEQ(a.foo[0][0], 1); + arktest.assertEQ(a.foo[0][1], 3); + arktest.assertEQ(a.foo[1][0], -2); let c = a.bar(a.foo); arktest.assertEQ(a.foo.length, c.length); arktest.assertEQ(a.foo[0].length, c[0].length); arktest.assertEQ(a.foo[1].length, c[1].length); - arktest.assertEQ(a.foo[0][0].unboxed(), c[0][0].unboxed()); - arktest.assertEQ(a.foo[0][1].unboxed(), c[0][1].unboxed()); - arktest.assertEQ(a.foo[1][0].unboxed(), c[1][0].unboxed()); + arktest.assertEQ(a.foo[0][0], c[0][0]); + arktest.assertEQ(a.foo[0][1], c[0][1]); + arktest.assertEQ(a.foo[1][0], c[1][0]); } - decl: |- diff --git a/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/04.accessible/type_name_params.params.yaml b/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/04.accessible/type_name_params.params.yaml index e9e290d549..d8e62d577f 100644 --- a/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/04.accessible/type_name_params.params.yaml +++ b/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/04.accessible/type_name_params.params.yaml @@ -87,70 +87,6 @@ cases: } # Boxed - - decl: |- - type T = Byte - check: |- - function main() { - let a: T = new Byte(0x7F.toByte()); - arktest.assertEQ(foo(a).unboxed(), 0x7F.toByte()); - } - - - decl: |- - type T = Short - check: |- - function main() { - let a: T = new Short(2); - arktest.assertEQ(foo(a).unboxed(), new Short(2)); - } - - - decl: |- - type T = Int - check: |- - function main() { - let a: T = new Int(3); - arktest.assertEQ(foo(a).unboxed(), new Int(3)); - } - - - decl: |- - type T = Long - check: |- - function main() { - let a: T = new Long(4); - arktest.assertEQ(foo(a).unboxed(), new Long(4)); - } - - - decl: |- - type T = Float - check: |- - function main() { - let a: T = new Float(0.1); - arktest.assertEQ(foo(a).unboxed(), new Float(0.1)); - } - - - decl: |- - type T = Double - check: |- - function main() { - let a: T = new Double(0.1); - arktest.assertEQ(foo(a).unboxed(), new Double(0.1)); // Double is an alias to Number - } - - - decl: |- - type T = Number - check: |- - function main() { - let a: T = new Number(0.1 as number); - arktest.assertEQ(foo(a).unboxed(), 0.1 as number); - } - - - decl: |- - type T = Char - check: |- - function main() { - let a: T = new Char(c'b'); - arktest.assertEQ(foo(a).unboxed(), c'b'); - } - - decl: |- type T = string check: |- @@ -167,14 +103,6 @@ cases: arktest.assertEQ(foo(a), "some string"); } - - decl: |- - type T = Boolean - check: |- - function main() { - let a: T = new Boolean(false); - arktest.assertEQ(foo(a).unboxed(), false); - } - # Custom - decl: |- type T = int[] @@ -196,8 +124,8 @@ cases: arktest.assertEQ(a.length, b.length); arktest.assertEQ(a[0].length, b[0].length); arktest.assertEQ(a[1].length, b[1].length); - arktest.assertEQ(a[0][0].unboxed(), b[0][0].unboxed()); - arktest.assertEQ(a[1][0].unboxed(), b[1][0].unboxed()); + arktest.assertEQ(a[0][0], b[0][0]); + arktest.assertEQ(a[1][0], b[1][0]); } - decl: |- diff --git a/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/05.type_declarations/01.type_alias_declaration/alias.params.yaml b/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/05.type_declarations/01.type_alias_declaration/alias.params.yaml index 387b8e8843..65fe7479be 100644 --- a/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/05.type_declarations/01.type_alias_declaration/alias.params.yaml +++ b/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/05.type_declarations/01.type_alias_declaration/alias.params.yaml @@ -20,24 +20,6 @@ cases: let v: Rating = 1.1 let ok = (v as double) == 1.1 - # boxed refs - - defs: |- - type Burden = Load - type Load = Mass - type Mass = Weight - type Weight = Double - use: |- - let v: Burden = new Double(1.1) - let ok = v.unboxed() == 1.1 - - - defs: |- - type Weight = Double|null - type Burden = Weight - use: |- - let v1: Burden = null - let v2: Burden = 42.0 - let ok = v1 == null && v2.unboxed() == 42.0 - # arrays - defs: |- type IntArray = int[] @@ -108,7 +90,7 @@ cases: type Func = (p: long) => Long use: |- let v: Func = foo - let ok = v(-9223372036854775808 as long).unboxed() == Long.MIN_VALUE + let ok = v(-9223372036854775808 as long) == Long.MIN_VALUE # classes - defs: |- diff --git a/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/05.type_declarations/01.type_alias_declaration/alias_gen.params.yaml b/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/05.type_declarations/01.type_alias_declaration/alias_gen.params.yaml index bc8c65ce30..1083b16d7c 100644 --- a/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/05.type_declarations/01.type_alias_declaration/alias_gen.params.yaml +++ b/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/05.type_declarations/01.type_alias_declaration/alias_gen.params.yaml @@ -18,14 +18,14 @@ cases: type Func = (p: int) => T; use: |- let v: Func = (p: int): Int => { return new Int(p); }; - let ok = v(1).unboxed() == 1; + let ok = v(1) == 1; - defs: |- type Func = (p: int) => T; type NullableFunc = Func|null; use: |- let v: NullableFunc = (p: int): Int => { return new Int(p); }; - let ok = v(1).unboxed() == 1; + let ok = v(1) == 1; - defs: |- type Func = (p: int) => T; @@ -55,14 +55,14 @@ cases: type FF = Func[] use: |- let v: FF = [(p: int): Int => { return new Int(p); }] - let ok = v[0](1).unboxed() == 1; + let ok = v[0](1) == 1; - defs: |- type Func = (p: int) => T; type FF = Func[] use: |- let v: FF = [(p: int): Int => { return new Int(p); }] - let ok = v[0](1).unboxed() == 1; + let ok = v[0](1) == 1; # classes - defs: |- diff --git a/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/06.variable_and_constant_declarations/01.variable_declarations/var_decl.params.yaml b/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/06.variable_and_constant_declarations/01.variable_declarations/var_decl.params.yaml index 26b241febd..9c821d3f69 100644 --- a/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/06.variable_and_constant_declarations/01.variable_declarations/var_decl.params.yaml +++ b/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/06.variable_and_constant_declarations/01.variable_declarations/var_decl.params.yaml @@ -32,4 +32,4 @@ var_decl: - decl: let x:Object; use: x = new Number(42); // assigned before first use - assert: x instanceof Number && (x as Number).unboxed() == 42 + assert: x instanceof Number && (x as Number) == 42 diff --git a/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/06.variable_and_constant_declarations/04.type_inference_from_initializer/infer.params.yaml b/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/06.variable_and_constant_declarations/04.type_inference_from_initializer/infer.params.yaml index 819ad2badf..bdd8760c94 100644 --- a/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/06.variable_and_constant_declarations/04.type_inference_from_initializer/infer.params.yaml +++ b/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/06.variable_and_constant_declarations/04.type_inference_from_initializer/infer.params.yaml @@ -13,15 +13,6 @@ --- cases: - - decl: 'const INT = 1 + 2 + 3 * 4; // inferred int' - assert: new Int(INT).unboxed() == 15 - - - decl: 'let DOUBLE = 3.0 / 2.0; // inferred double' - assert: new Double(DOUBLE).unboxed() == 1.5 - - - decl: 'const arr = new long[1]; // inferred array of longs' - assert: new Long(arr[0]).unboxed() == 0 as long - - decl: 'let arr = new Object[1]; // inferred array of Objects' use: ' arr[0] = new Object();' assert: arr[0] instanceof Object @@ -29,10 +20,6 @@ cases: - decl: 'let arr = new (Error|undefined)[1]; // inferred array of Error|undefined' assert: arr[0] == undefined - - decl: 'const obj = new Object[1]; // inferred array of Objects' - use: 'obj[0] = new Long(Long.MAX_VALUE);' - assert: obj instanceof Object[] && obj[0] instanceof Long && (obj[0] as Long).unboxed() == Long.MAX_VALUE - - decl: 'let arr:FixedArray>> = new byte[1][2][3]; // inferred three-dimensional array of bytes' assert: arr instanceof FixedArray>> && arr[0][0][0] == 0 diff --git a/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/07.function_declarations/02.parameter_list/param_list.params.yaml b/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/07.function_declarations/02.parameter_list/param_list.params.yaml index 8716a45231..7264d6901e 100644 --- a/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/07.function_declarations/02.parameter_list/param_list.params.yaml +++ b/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/07.function_declarations/02.parameter_list/param_list.params.yaml @@ -114,4 +114,4 @@ function_decls: } call: |- let v: Byte = foo(1 as byte, null, Long.MIN_VALUE, new Byte(1 as byte), new Byte(2 as byte)) - arktest.assertTrue( v instanceof Byte && v.unboxed() == 1 ) + arktest.assertTrue( v instanceof Byte && v.toByte() == 1 ) diff --git a/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/07.function_declarations/03.readonly_parameters/readonly_custom_neg.params.yaml b/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/07.function_declarations/03.readonly_parameters/readonly_custom_neg.params.yaml index a4be8c00d6..715dae7562 100644 --- a/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/07.function_declarations/03.readonly_parameters/readonly_custom_neg.params.yaml +++ b/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/07.function_declarations/03.readonly_parameters/readonly_custom_neg.params.yaml @@ -159,7 +159,7 @@ cases: - decl: |- function foo(array?: readonly [string, Number]) { - arktest.assertTrue(array[1].unboxed() == 2.2) + arktest.assertTrue(array[1].toDouble() == 2.2) } foo(["str", new Number(2.2)]) diff --git a/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/07.function_declarations/08.return_type_inference/ret_type_infer.params.yaml b/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/07.function_declarations/08.return_type_inference/ret_type_infer.params.yaml index 51f9c0dd7c..1e92cb34e6 100644 --- a/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/07.function_declarations/08.return_type_inference/ret_type_infer.params.yaml +++ b/static_core/plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/07.function_declarations/08.return_type_inference/ret_type_infer.params.yaml @@ -20,15 +20,6 @@ cases: call: |- arktest.assertTrue(foo() == new Byte(127)); - - decl: |- - function foo() { // infer Byte - return new Byte(127); - } - call: |- - let b = foo(); - arktest.assertTrue(b instanceof Byte); - arktest.assertTrue(b.unboxed() == new Byte(127)); - - decl: |- function foo() { // infer short return 2 as short; @@ -36,24 +27,6 @@ cases: call: |- arktest.assertTrue(foo() == new Short(2)); - - decl: |- - function foo() { // infer Short - return new Short(new Short(2)); - } - call: |- - let b = foo(); - arktest.assertTrue(b instanceof Short); - arktest.assertTrue(b.unboxed() == new Short(2)); - - - decl: |- - function foo() { // infer Int - return new Int(2); - } - call: |- - let b = foo(); - arktest.assertTrue(b instanceof Int); - arktest.assertTrue(b.unboxed() == new Int(2)); - - decl: |- function foo() { // infer long return new Long(3); @@ -61,15 +34,6 @@ cases: call: |- arktest.assertTrue(foo() == new Long(3)); - - decl: |- - function foo() { // infer Long - return new Long(3); - } - call: |- - let b = foo(); - arktest.assertTrue(b instanceof Long); - arktest.assertTrue(b.unboxed() == new Long(3)); - - decl: |- function foo() { // infer float return 4.2f @@ -77,15 +41,6 @@ cases: call: |- arktest.assertTrue(foo() == 4.2f); - - decl: |- - function foo() { // infer Float - return new Float(4.3); - } - call: |- - let b = foo(); - arktest.assertTrue(b instanceof Float); - arktest.assertTrue(b.unboxed() == new Float(4.3)); - - decl: |- function foo() { // infer double return new Double(5.3); @@ -93,24 +48,6 @@ cases: call: |- arktest.assertTrue(foo() == new Double(5.3)); - - decl: |- - function foo() { // infer Double - return new Double(5.4); - } - call: |- - let b = foo(); - arktest.assertTrue(b instanceof Double); - arktest.assertTrue(b.unboxed() == new Double(5.4)); - - - decl: |- - function foo() { // infer Number - return new Number(6.4 as number); - } - call: |- - let b = foo(); - arktest.assertTrue(b instanceof Number); - arktest.assertTrue(b.unboxed() == 6.4 as number); - - decl: |- function foo() { // infer char return c'A'; @@ -118,15 +55,6 @@ cases: call: |- arktest.assertTrue(foo() == c'A'); - - decl: |- - function foo() { // infer Char - return new Char(c'b'); - } - call: |- - let b = foo(); - arktest.assertTrue(b instanceof Char); - arktest.assertTrue(b.unboxed() == c'b'); - - decl: |- function foo() { // infer String return new String("some str"); @@ -143,15 +71,6 @@ cases: call: |- arktest.assertTrue(foo()); - - decl: |- - function foo() { // infer Boolean - return new Boolean(false); - } - call: |- - let b = foo(); - arktest.assertTrue(b instanceof Boolean); - arktest.assertTrue(b.unboxed() == false); - - decl: |- function foo() { // infer null return null; @@ -261,17 +180,6 @@ cases: let i = foo() arktest.assertTrue(i instanceof TPL); - - decl: |- - type A = Byte // infer custom type - function foo() { - let i: A = new Byte(2 as byte); - return i; - } - call: |- - let i = foo(); - arktest.assertTrue(i instanceof Byte); - arktest.assertTrue(i.unboxed() == 2 as byte); - - decl: |- const cstr = "some string" // infer string/char function foo(i: boolean) { diff --git a/static_core/plugins/ets/tests/ets-templates/07.expressions/01.evaluation_of_expressions/01.normal_and_abrupt_completion_of_expression_evaluation/cce2.ets b/static_core/plugins/ets/tests/ets-templates/07.expressions/01.evaluation_of_expressions/01.normal_and_abrupt_completion_of_expression_evaluation/cce2.ets index 2ff34825f6..aa166c820a 100644 --- a/static_core/plugins/ets/tests/ets-templates/07.expressions/01.evaluation_of_expressions/01.normal_and_abrupt_completion_of_expression_evaluation/cce2.ets +++ b/static_core/plugins/ets/tests/ets-templates/07.expressions/01.evaluation_of_expressions/01.normal_and_abrupt_completion_of_expression_evaluation/cce2.ets @@ -24,7 +24,7 @@ function main(): int { let t: Long|null = (): Long|null => { return null; }(); try { - let v: long = (a = 2) + (t === null ? 0 : t.unboxed()) + (b = 2); + let v: long = (a = 2) + (t === null ? 0 : t.toLong()) + (b = 2); if (a != 2 || b != 2) return 1; return 0; } catch (e) { diff --git a/static_core/plugins/ets/tests/ets-templates/07.expressions/01.evaluation_of_expressions/eval_decl.ets b/static_core/plugins/ets/tests/ets-templates/07.expressions/01.evaluation_of_expressions/eval_decl.ets index 1fd220cb3c..7941a858dc 100644 --- a/static_core/plugins/ets/tests/ets-templates/07.expressions/01.evaluation_of_expressions/eval_decl.ets +++ b/static_core/plugins/ets/tests/ets-templates/07.expressions/01.evaluation_of_expressions/eval_decl.ets @@ -22,7 +22,7 @@ desc: >- type Incrementor = (i: int) => int; let sg: int; -let ig: int = new Int(1).unboxed(); +let ig: int = new Int(1).toInt(); class A { public fld: int = 42 + (sg = "abc".length.toInt()); diff --git a/static_core/plugins/ets/tests/ets-templates/15.semantic_rules/14.compatibility_features/01.extended_conditional_expressions/cond_f1.params.yaml b/static_core/plugins/ets/tests/ets-templates/15.semantic_rules/14.compatibility_features/01.extended_conditional_expressions/cond_f1.params.yaml index d412baf031..54cee47479 100644 --- a/static_core/plugins/ets/tests/ets-templates/15.semantic_rules/14.compatibility_features/01.extended_conditional_expressions/cond_f1.params.yaml +++ b/static_core/plugins/ets/tests/ets-templates/15.semantic_rules/14.compatibility_features/01.extended_conditional_expressions/cond_f1.params.yaml @@ -36,13 +36,13 @@ cases: - 'new Double(-0)' - '-0 as number' - - new Byte().unboxed() - - new Short().unboxed() - - new Int().unboxed() - - new Float().unboxed() - - new Double().unboxed() - - new Number().unboxed() - - new Char().unboxed() + - new Byte().toByte() + - new Short().toShort() + - new Int().toInt() + - new Float().toFloat() + - new Double().toDouble() + - new Number().toDouble() + - new Char().toChar() - '""' - '``' diff --git a/static_core/plugins/ets/tests/ets-templates/15.semantic_rules/14.compatibility_features/01.extended_conditional_expressions/if_f1.params.yaml b/static_core/plugins/ets/tests/ets-templates/15.semantic_rules/14.compatibility_features/01.extended_conditional_expressions/if_f1.params.yaml index b0c2b27034..a710ba2c0b 100644 --- a/static_core/plugins/ets/tests/ets-templates/15.semantic_rules/14.compatibility_features/01.extended_conditional_expressions/if_f1.params.yaml +++ b/static_core/plugins/ets/tests/ets-templates/15.semantic_rules/14.compatibility_features/01.extended_conditional_expressions/if_f1.params.yaml @@ -36,13 +36,13 @@ cases: - 'new Double(-0)' - '-0 as number' - - new Byte().unboxed() - - new Short().unboxed() - - new Int().unboxed() - - new Float().unboxed() - - new Double().unboxed() - - new Number().unboxed() - - new Char().unboxed() + - new Byte().toByte() + - new Short().toShort() + - new Int().toInt() + - new Float().toFloat() + - new Double().toDouble() + - new Number().toDouble() + - new Char().toChar() - '""' - '``' 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..45cfb5fa60 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 @@ -47,12 +47,12 @@ cases: - 'Float.MIN_VALUE' - 'Float.MAX_VALUE' - - new Byte(11).unboxed() - - new Short(1111).unboxed() - - new Int(111111).unboxed() - - new Float(11111111.0).unboxed() - - new Double(1111111111.0).unboxed() - - new Number(1e33 as number).unboxed() + - new Byte(11).toByte() + - new Short(1111).toShort() + - new Int(111111).toInt() + - new Float(11111111.0).toFloat() + - new Double(1111111111.0).toDouble() + - new Number(1e33 as number).toDouble() - '" "' - '` `' diff --git a/static_core/plugins/ets/tests/ets-templates/17.experimental_features/08.statements/01.for-of_type_annotation/for_of.params.yaml b/static_core/plugins/ets/tests/ets-templates/17.experimental_features/08.statements/01.for-of_type_annotation/for_of.params.yaml index 87e9a57eee..562bed3437 100644 --- a/static_core/plugins/ets/tests/ets-templates/17.experimental_features/08.statements/01.for-of_type_annotation/for_of.params.yaml +++ b/static_core/plugins/ets/tests/ets-templates/17.experimental_features/08.statements/01.for-of_type_annotation/for_of.params.yaml @@ -101,12 +101,12 @@ cases: - use: |- // array of primitives (int) with implicit boxing - for (const v: Int of [9, 8, 7, 6, 5]) res += v.unboxed() + for (const v: Int of [9, 8, 7, 6, 5]) res += v.toInt() if (res == "98765") return 0; - use: |- // array of primitives (boolean) with implicit boxing - for (const v: Boolean of [false, true, true, false]) res += v.unboxed() + for (const v: Boolean of [false, true, true, false]) res += v.toBoolean() if (res == "falsetruetruefalse") return 0; - decl: |- diff --git a/static_core/plugins/ets/tests/ets-templates_deprecated/01.predefined_types__02.boxed_types/bt.ets b/static_core/plugins/ets/tests/ets-templates_deprecated/01.predefined_types__02.boxed_types/bt.ets index 17bd89eff8..ebdb46de73 100644 --- a/static_core/plugins/ets/tests/ets-templates_deprecated/01.predefined_types__02.boxed_types/bt.ets +++ b/static_core/plugins/ets/tests/ets-templates_deprecated/01.predefined_types__02.boxed_types/bt.ets @@ -27,7 +27,7 @@ function main() { {%- for t in c['values'] %} let prim{{loop.index}}: {{c.from_type}} = {{t.expr|safe}} boxed = new {{c.to_type}}(prim{{loop.index}}) - arktest.assertEQ( boxed.unboxed(), {{t.val}} ) + arktest.assertEQ( boxed, {{t.val}} ) {%- endfor %} } {%- endfor %} diff --git a/static_core/plugins/ets/tests/ets-templates_deprecated/01.predefined_types__02.boxed_types/bt_default.ets b/static_core/plugins/ets/tests/ets-templates_deprecated/01.predefined_types__02.boxed_types/bt_default.ets index 0b8cec5b06..9242fa1d4f 100644 --- a/static_core/plugins/ets/tests/ets-templates_deprecated/01.predefined_types__02.boxed_types/bt_default.ets +++ b/static_core/plugins/ets/tests/ets-templates_deprecated/01.predefined_types__02.boxed_types/bt_default.ets @@ -31,15 +31,15 @@ let c = new Char() let bool = new Boolean() function main() { - arktest.assertEQ( b.unboxed(), 0 ) - arktest.assertEQ( s.unboxed(), 0 ) - arktest.assertEQ( i.unboxed(), 0 ) - arktest.assertEQ( l.unboxed(), 0 ) - arktest.assertEQ( f.unboxed(), 0.0f ) - arktest.assertEQ( d.unboxed(), 0.0 ) - arktest.assertEQ( n.unboxed(), 0.0 ) - arktest.assertEQ( c.unboxed(), c'\u0000' ) - arktest.assertEQ( bool.unboxed(), false ) + arktest.assertEQ( b, 0 ) + arktest.assertEQ( s, 0 ) + arktest.assertEQ( i, 0 ) + arktest.assertEQ( l, 0 ) + arktest.assertEQ( f, 0.0f ) + arktest.assertEQ( d, 0.0 ) + arktest.assertEQ( n, 0.0 ) + arktest.assertEQ( c, c'\u0000' ) + arktest.assertEQ( bool, false ) arktest.assertEQ( b, 0 ) arktest.assertEQ( s, 0 ) diff --git a/static_core/plugins/ets/tests/ets-templates_deprecated/01.predefined_types__02.boxed_types/bt_nan.ets b/static_core/plugins/ets/tests/ets-templates_deprecated/01.predefined_types__02.boxed_types/bt_nan.ets index 87fef11387..766ffc95c0 100644 --- a/static_core/plugins/ets/tests/ets-templates_deprecated/01.predefined_types__02.boxed_types/bt_nan.ets +++ b/static_core/plugins/ets/tests/ets-templates_deprecated/01.predefined_types__02.boxed_types/bt_nan.ets @@ -28,7 +28,7 @@ function main() { let prim{{loop.index}}: {{c.from_type}} = {{t.expr|safe}} boxed = new {{c.to_type}}(prim{{loop.index}}) arktest.assertTrue( boxed.isNaN() ) - arktest.assertTrue( {{c.to_type}}.isNaN(boxed.unboxed()) ) + arktest.assertTrue( {{c.to_type}}.isNaN(boxed) ) {%- endfor %} } {%- endfor %} diff --git a/static_core/plugins/ets/tests/ets-templates_deprecated/04.boxing_conversion/assn_var/assn-var.ets b/static_core/plugins/ets/tests/ets-templates_deprecated/04.boxing_conversion/assn_var/assn-var.ets index 02293176ff..f2e3cd65dc 100644 --- a/static_core/plugins/ets/tests/ets-templates_deprecated/04.boxing_conversion/assn_var/assn-var.ets +++ b/static_core/plugins/ets/tests/ets-templates_deprecated/04.boxing_conversion/assn_var/assn-var.ets @@ -26,7 +26,7 @@ function main(): int { {%- for t in c['values'] %} let s{{loop.index}}: {{c.from_type}} = {{t.expr|safe}} d{{loop.index}} = s{{loop.index}} - if (d{{loop.index}}.unboxed() != {{t.val}}) { + if (d{{loop.index}} != {{t.val}}) { return 1 } {%- endfor %} diff --git a/static_core/plugins/ets/tests/ets-templates_deprecated/04.boxing_conversion/call_cons/call-cons-nan.ets b/static_core/plugins/ets/tests/ets-templates_deprecated/04.boxing_conversion/call_cons/call-cons-nan.ets index 7c774728c3..8775af8bc2 100644 --- a/static_core/plugins/ets/tests/ets-templates_deprecated/04.boxing_conversion/call_cons/call-cons-nan.ets +++ b/static_core/plugins/ets/tests/ets-templates_deprecated/04.boxing_conversion/call_cons/call-cons-nan.ets @@ -27,7 +27,7 @@ class A { function main(): int { {%- for t in c['values'] %} let s{{loop.index}}: {{c.from_type}} = {{t.expr|safe}} - if (! {{c.to_type}}.isNaN(new A(s{{loop.index}}).f.unboxed())) { + if (! {{c.to_type}}.isNaN(new A(s{{loop.index}}).f)) { return 1 } {%- endfor %} diff --git a/static_core/plugins/ets/tests/ets-templates_deprecated/04.boxing_conversion/call_cons/call-cons.ets b/static_core/plugins/ets/tests/ets-templates_deprecated/04.boxing_conversion/call_cons/call-cons.ets index 2f7fc8ce75..cf3de2e1f5 100644 --- a/static_core/plugins/ets/tests/ets-templates_deprecated/04.boxing_conversion/call_cons/call-cons.ets +++ b/static_core/plugins/ets/tests/ets-templates_deprecated/04.boxing_conversion/call_cons/call-cons.ets @@ -27,7 +27,7 @@ class A { function main(): int { {%- for t in c['values'] %} let s{{loop.index}}: {{c.from_type}} = {{t.expr|safe}} - if (new A(s{{loop.index}}).f.unboxed() != {{t.val}}) { + if (new A(s{{loop.index}}).f != {{t.val}}) { return 1 } {%- endfor %} diff --git a/static_core/plugins/ets/tests/ets-templates_deprecated/04.boxing_conversion/call_func/call-func-nan.ets b/static_core/plugins/ets/tests/ets-templates_deprecated/04.boxing_conversion/call_func/call-func-nan.ets index 6d13560531..f8c17ed850 100644 --- a/static_core/plugins/ets/tests/ets-templates_deprecated/04.boxing_conversion/call_func/call-func-nan.ets +++ b/static_core/plugins/ets/tests/ets-templates_deprecated/04.boxing_conversion/call_func/call-func-nan.ets @@ -24,7 +24,7 @@ function foo(p: {{c.to_type}}): {{c.to_type}} { return p } function main(): int { {%- for t in c['values'] %} let s{{loop.index}}: {{c.from_type}} = {{t.expr|safe}} - if (! {{c.to_type}}.isNaN(foo(s{{loop.index}}).unboxed())) { + if (! {{c.to_type}}.isNaN(foo(s{{loop.index}}))) { return 1 } {%- endfor %} diff --git a/static_core/plugins/ets/tests/ets-templates_deprecated/04.boxing_conversion/call_func/call-func.ets b/static_core/plugins/ets/tests/ets-templates_deprecated/04.boxing_conversion/call_func/call-func.ets index c3cc3e149d..e192b82704 100644 --- a/static_core/plugins/ets/tests/ets-templates_deprecated/04.boxing_conversion/call_func/call-func.ets +++ b/static_core/plugins/ets/tests/ets-templates_deprecated/04.boxing_conversion/call_func/call-func.ets @@ -24,7 +24,7 @@ function foo(p: {{c.to_type}}): {{c.to_type}} { return p } function main(): int { {%- for t in c['values'] %} let s{{loop.index}}: {{c.from_type}} = {{t.expr|safe}} - if (foo(s{{loop.index}}).unboxed() != {{t.val}}) { + if (foo(s{{loop.index}}) != {{t.val}}) { return 1 } {%- endfor %} diff --git a/static_core/plugins/ets/tests/ets-templates_deprecated/04.boxing_conversion/call_lmbd/call-lmbd-nan.ets b/static_core/plugins/ets/tests/ets-templates_deprecated/04.boxing_conversion/call_lmbd/call-lmbd-nan.ets index f67a03c0c7..5bf1ca3f5c 100644 --- a/static_core/plugins/ets/tests/ets-templates_deprecated/04.boxing_conversion/call_lmbd/call-lmbd-nan.ets +++ b/static_core/plugins/ets/tests/ets-templates_deprecated/04.boxing_conversion/call_lmbd/call-lmbd-nan.ets @@ -22,7 +22,7 @@ params: NaN conversion from {{c.from_type}} to {{c.to_type}} function main(): int { {%- for t in c['values'] %} let s{{loop.index}}: {{c.from_type}} = {{t.expr|safe}} - if (! {{c.to_type}}.isNaN(((p: {{c.to_type}}): {{c.to_type}} => { return p })(s{{loop.index}}).unboxed())) { + if (! {{c.to_type}}.isNaN(((p: {{c.to_type}}): {{c.to_type}} => { return p })(s{{loop.index}}))) { return 1 } {%- endfor %} diff --git a/static_core/plugins/ets/tests/ets-templates_deprecated/04.boxing_conversion/call_lmbd/call-lmbd.ets b/static_core/plugins/ets/tests/ets-templates_deprecated/04.boxing_conversion/call_lmbd/call-lmbd.ets index 804c8e0aff..6ea6f761e0 100644 --- a/static_core/plugins/ets/tests/ets-templates_deprecated/04.boxing_conversion/call_lmbd/call-lmbd.ets +++ b/static_core/plugins/ets/tests/ets-templates_deprecated/04.boxing_conversion/call_lmbd/call-lmbd.ets @@ -22,7 +22,7 @@ params: from {{c.from_type}} to {{c.to_type}} function main(): int { {%- for t in c['values'] %} let s{{loop.index}}: {{c.from_type}} = {{t.expr|safe}} - if (((p: {{c.to_type}}): {{c.to_type}} => { return p })(s{{loop.index}}).unboxed() != {{t.val}}) { + if (((p: {{c.to_type}}): {{c.to_type}} => { return p })(s{{loop.index}}) != {{t.val}}) { return 1 } {%- endfor %} diff --git a/static_core/plugins/ets/tests/ets-templates_deprecated/04.boxing_conversion/call_meth/call-meth-nan.ets b/static_core/plugins/ets/tests/ets-templates_deprecated/04.boxing_conversion/call_meth/call-meth-nan.ets index 0236c2750a..9d775dbb43 100644 --- a/static_core/plugins/ets/tests/ets-templates_deprecated/04.boxing_conversion/call_meth/call-meth-nan.ets +++ b/static_core/plugins/ets/tests/ets-templates_deprecated/04.boxing_conversion/call_meth/call-meth-nan.ets @@ -27,7 +27,7 @@ function main(): int { let a: A = new A() {%- for t in c['values'] %} let s{{loop.index}}: {{c.from_type}} = {{t.expr|safe}} - if (! {{c.to_type}}.isNaN(a.meth(s{{loop.index}}).unboxed())) { + if (! {{c.to_type}}.isNaN(a.meth(s{{loop.index}}))) { return 1 } {%- endfor %} diff --git a/static_core/plugins/ets/tests/ets-templates_deprecated/04.boxing_conversion/call_meth/call-meth.ets b/static_core/plugins/ets/tests/ets-templates_deprecated/04.boxing_conversion/call_meth/call-meth.ets index be95b54ba7..0b8e1b769f 100644 --- a/static_core/plugins/ets/tests/ets-templates_deprecated/04.boxing_conversion/call_meth/call-meth.ets +++ b/static_core/plugins/ets/tests/ets-templates_deprecated/04.boxing_conversion/call_meth/call-meth.ets @@ -27,7 +27,7 @@ function main(): int { let a: A = new A() {%- for t in c['values'] %} let s{{loop.index}}: {{c.from_type}} = {{t.expr|safe}} - if (a.meth(s{{loop.index}}).unboxed() != {{t.val}}) { + if (a.meth(s{{loop.index}}) != {{t.val}}) { return 1 } {%- endfor %} diff --git a/static_core/plugins/ets/tests/ets-templates_deprecated/04.boxing_conversion/comp_arr/comp-arr-nan.ets b/static_core/plugins/ets/tests/ets-templates_deprecated/04.boxing_conversion/comp_arr/comp-arr-nan.ets index 9739e7a334..c3fa163279 100644 --- a/static_core/plugins/ets/tests/ets-templates_deprecated/04.boxing_conversion/comp_arr/comp-arr-nan.ets +++ b/static_core/plugins/ets/tests/ets-templates_deprecated/04.boxing_conversion/comp_arr/comp-arr-nan.ets @@ -27,7 +27,7 @@ function main(): int { let d{{loop.index}}: {{c.to_type}}[] = [s{{loop.index}}, s{{loop.index}}] d{{loop.index}} = [] d{{loop.index}} = [s{{loop.index}}] - if (! {{c.to_type}}.isNaN(d{{loop.index}}[0].unboxed())) { + if (! {{c.to_type}}.isNaN(d{{loop.index}}[0])) { return 1 } {%- endfor %} diff --git a/static_core/plugins/ets/tests/ets-templates_deprecated/04.boxing_conversion/comp_arr/comp-arr.ets b/static_core/plugins/ets/tests/ets-templates_deprecated/04.boxing_conversion/comp_arr/comp-arr.ets index deb2d8d195..a4ff54f3de 100644 --- a/static_core/plugins/ets/tests/ets-templates_deprecated/04.boxing_conversion/comp_arr/comp-arr.ets +++ b/static_core/plugins/ets/tests/ets-templates_deprecated/04.boxing_conversion/comp_arr/comp-arr.ets @@ -27,7 +27,7 @@ function main(): int { let d{{loop.index}}: {{c.to_type}}[] = [s{{loop.index}}, s{{loop.index}}] d{{loop.index}} = [] d{{loop.index}} = [s{{loop.index}}] - if (d{{loop.index}}[0].unboxed() != {{t.val}}) { + if (d{{loop.index}}[0] != {{t.val}}) { return 1 } {%- endfor %} diff --git a/static_core/plugins/ets/tests/ets-templates_deprecated/04.boxing_conversion/comp_obj/comp-clss-nan.ets b/static_core/plugins/ets/tests/ets-templates_deprecated/04.boxing_conversion/comp_obj/comp-clss-nan.ets index b789859c0c..b9687fb414 100644 --- a/static_core/plugins/ets/tests/ets-templates_deprecated/04.boxing_conversion/comp_obj/comp-clss-nan.ets +++ b/static_core/plugins/ets/tests/ets-templates_deprecated/04.boxing_conversion/comp_obj/comp-clss-nan.ets @@ -26,7 +26,7 @@ let s{{loop.index}}: {{c.from_type}} = {{t.expr|safe}}; function main(): int { {%- for t in c['values'] %} let d{{loop.index}}: A{{loop.index}} = { fld: s{{loop.index}} } - if (! {{c.to_type}}.isNaN(d{{loop.index}}.fld.unboxed())) { + if (! {{c.to_type}}.isNaN(d{{loop.index}}.fld)) { return 1 } {%- endfor %} diff --git a/static_core/plugins/ets/tests/ets-templates_deprecated/04.boxing_conversion/comp_obj/comp-clss.ets b/static_core/plugins/ets/tests/ets-templates_deprecated/04.boxing_conversion/comp_obj/comp-clss.ets index 0d89d12e5a..65c4e08a8f 100644 --- a/static_core/plugins/ets/tests/ets-templates_deprecated/04.boxing_conversion/comp_obj/comp-clss.ets +++ b/static_core/plugins/ets/tests/ets-templates_deprecated/04.boxing_conversion/comp_obj/comp-clss.ets @@ -26,7 +26,7 @@ let s{{loop.index}}: {{c.from_type}} = {{t.expr|safe}}; function main(): int { {%- for t in c['values'] %} let d{{loop.index}}: A{{loop.index}} = { fld: s{{loop.index}} } - if (d{{loop.index}}.fld.unboxed() != {{t.val}}) { + if (d{{loop.index}}.fld != {{t.val}}) { return 1 } {%- endfor %} diff --git a/static_core/plugins/ets/tests/ets-templates_deprecated/04.boxing_conversion/comp_obj/comp-intf-nan.ets b/static_core/plugins/ets/tests/ets-templates_deprecated/04.boxing_conversion/comp_obj/comp-intf-nan.ets index 4c2d8405e1..b40507a467 100644 --- a/static_core/plugins/ets/tests/ets-templates_deprecated/04.boxing_conversion/comp_obj/comp-intf-nan.ets +++ b/static_core/plugins/ets/tests/ets-templates_deprecated/04.boxing_conversion/comp_obj/comp-intf-nan.ets @@ -26,7 +26,7 @@ let s{{loop.index}}: {{c.from_type}} = {{t.expr|safe}}; function main(): int { {%- for t in c['values'] %} let d{{loop.index}}: J{{loop.index}} = { fld: s{{loop.index}} } - if (! {{c.to_type}}.isNaN(d{{loop.index}}.fld.unboxed())) { + if (! {{c.to_type}}.isNaN(d{{loop.index}}.fld)) { return 1 } {%- endfor %} diff --git a/static_core/plugins/ets/tests/ets-templates_deprecated/04.boxing_conversion/comp_obj/comp-intf.ets b/static_core/plugins/ets/tests/ets-templates_deprecated/04.boxing_conversion/comp_obj/comp-intf.ets index 3bd64f4cd9..2e271b8e70 100644 --- a/static_core/plugins/ets/tests/ets-templates_deprecated/04.boxing_conversion/comp_obj/comp-intf.ets +++ b/static_core/plugins/ets/tests/ets-templates_deprecated/04.boxing_conversion/comp_obj/comp-intf.ets @@ -26,7 +26,7 @@ let s{{loop.index}}: {{c.from_type}} = {{t.expr|safe}}; function main(): int { {%- for t in c['values'] %} let d{{loop.index}}: J{{loop.index}} = { fld: s{{loop.index}} } - if (d{{loop.index}}.fld.unboxed() != {{t.val}}) { + if (d{{loop.index}}.fld != {{t.val}}) { return 1 } {%- endfor %} diff --git a/static_core/plugins/ets/tests/ets-templates_deprecated/04.boxing_conversion/decl_const/decl-const-nan.ets b/static_core/plugins/ets/tests/ets-templates_deprecated/04.boxing_conversion/decl_const/decl-const-nan.ets index 1020699164..98968a9d41 100644 --- a/static_core/plugins/ets/tests/ets-templates_deprecated/04.boxing_conversion/decl_const/decl-const-nan.ets +++ b/static_core/plugins/ets/tests/ets-templates_deprecated/04.boxing_conversion/decl_const/decl-const-nan.ets @@ -23,7 +23,7 @@ function main(): int { {%- for t in c['values'] %} let s{{loop.index}}: {{c.from_type}} = {{t.expr|safe}} const d{{loop.index}}: {{c.to_type}} = s{{loop.index}} - if (! {{c.to_type}}.isNaN(d{{loop.index}}.unboxed())) { + if (! {{c.to_type}}.isNaN(d{{loop.index}})) { return 1 } {%- endfor %} diff --git a/static_core/plugins/ets/tests/ets-templates_deprecated/04.boxing_conversion/decl_const/decl-const.ets b/static_core/plugins/ets/tests/ets-templates_deprecated/04.boxing_conversion/decl_const/decl-const.ets index cae66a4f65..3373c05cae 100644 --- a/static_core/plugins/ets/tests/ets-templates_deprecated/04.boxing_conversion/decl_const/decl-const.ets +++ b/static_core/plugins/ets/tests/ets-templates_deprecated/04.boxing_conversion/decl_const/decl-const.ets @@ -23,7 +23,7 @@ function main(): int { {%- for t in c['values'] %} let s{{loop.index}}: {{c.from_type}} = {{t.expr|safe}} const d{{loop.index}}: {{c.to_type}} = s{{loop.index}} - if (d{{loop.index}}.unboxed() != {{t.val}}) { + if (d{{loop.index}} != {{t.val}}) { return 1 } {%- endfor %} diff --git a/static_core/plugins/ets/tests/ets-templates_deprecated/04.boxing_conversion/decl_field/decl-field-nan.ets b/static_core/plugins/ets/tests/ets-templates_deprecated/04.boxing_conversion/decl_field/decl-field-nan.ets index cb2ac512b6..e615efeace 100644 --- a/static_core/plugins/ets/tests/ets-templates_deprecated/04.boxing_conversion/decl_field/decl-field-nan.ets +++ b/static_core/plugins/ets/tests/ets-templates_deprecated/04.boxing_conversion/decl_field/decl-field-nan.ets @@ -29,7 +29,7 @@ class A{{loop.index}} { function main(): int { {%- for t in c['values'] %} let a{{loop.index}}: A{{loop.index}} = new A{{loop.index}}() - if (! {{c.to_type}}.isNaN(a{{loop.index}}.d.unboxed())) { + if (! {{c.to_type}}.isNaN(a{{loop.index}}.d)) { return 1 } {%- endfor %} diff --git a/static_core/plugins/ets/tests/ets-templates_deprecated/04.boxing_conversion/decl_field/decl-field.ets b/static_core/plugins/ets/tests/ets-templates_deprecated/04.boxing_conversion/decl_field/decl-field.ets index e09cec8e7c..47c3c04fa5 100644 --- a/static_core/plugins/ets/tests/ets-templates_deprecated/04.boxing_conversion/decl_field/decl-field.ets +++ b/static_core/plugins/ets/tests/ets-templates_deprecated/04.boxing_conversion/decl_field/decl-field.ets @@ -29,7 +29,7 @@ class A{{loop.index}} { function main(): int { {%- for t in c['values'] %} let a{{loop.index}}: A{{loop.index}} = new A{{loop.index}}() - if (a{{loop.index}}.d.unboxed() != {{t.val}}) { + if (a{{loop.index}}.d != {{t.val}}) { return 1 } {%- endfor %} diff --git a/static_core/plugins/ets/tests/ets-templates_deprecated/04.boxing_conversion/decl_var/decl-var.ets b/static_core/plugins/ets/tests/ets-templates_deprecated/04.boxing_conversion/decl_var/decl-var.ets index 5b21318981..589ec8a106 100644 --- a/static_core/plugins/ets/tests/ets-templates_deprecated/04.boxing_conversion/decl_var/decl-var.ets +++ b/static_core/plugins/ets/tests/ets-templates_deprecated/04.boxing_conversion/decl_var/decl-var.ets @@ -23,7 +23,7 @@ function main(): int { {%- for t in c['values'] %} let s{{loop.index}}: {{c.from_type}} = {{t.expr|safe}} let d{{loop.index}}: {{c.to_type}} = s{{loop.index}} - if (d{{loop.index}}.unboxed() != {{t.val}}) { + if (d{{loop.index}} != {{t.val}}) { return 1 } {%- endfor %} diff --git a/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/02.assignment-like_contexts/prim_boxing.ets b/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/02.assignment-like_contexts/prim_boxing.ets index 29e145b3c0..30c76b7e76 100644 --- a/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/02.assignment-like_contexts/prim_boxing.ets +++ b/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/02.assignment-like_contexts/prim_boxing.ets @@ -24,7 +24,7 @@ let dest: {{conv.dest}}; function main(): void { dest = origin; - arktest.assertTrue(dest.unboxed() == origin); + arktest.assertTrue(dest == origin); } {% endfor %} diff --git a/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/02.assignment-like_contexts/prim_unboxing.ets b/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/02.assignment-like_contexts/prim_unboxing.ets index bf5c506b46..88ddeffdef 100644 --- a/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/02.assignment-like_contexts/prim_unboxing.ets +++ b/static_core/plugins/ets/tests/ets-templates_deprecated/06.contexts_and_conversions/02.assignment-like_contexts/prim_unboxing.ets @@ -26,7 +26,7 @@ let dest: {{conv.dest}}; function main(): void { dest = origin; - artktest.assertEQ(dest, origin.unboxed()); + artktest.assertEQ(dest, origin); } {% endfor %} 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..62343a142f 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 @@ -26,9 +26,5 @@ cases: - { type: Byte, expr: new Byte(new Int(1).byteValue()), op: '!==' } - { type: Char, expr: new Char(c'A'), op: '!==' } - { type: 'char[]', expr: "[c'A', c'B']", op: '!==' } - - { type: '(x: Char) => char', expr: '(p: Char): char => { return p.unboxed(); }', op: '!==' } - - { type: '((x: Char) => char)[]', expr: '[(p: Char): char => { return p.unboxed(); }]', op: '!==' } - - { type: Foo, expr: '(p: Char): char => { return p.unboxed(); }', op: '!==' } - - { type: 'Foo[]', expr: '[(p: Char): char => { return p.unboxed(); }]', op: '!==' } - { type: 'Color', expr: Color.Red, op: '!==' } - { type: 'Color[]', expr: '[Color.Blue]', op: '!==' } diff --git a/static_core/plugins/ets/tests/ets_func_tests/escompat/JsonTest.ets b/static_core/plugins/ets/tests/ets_func_tests/escompat/JsonTest.ets index eb1962869d..16506fddd0 100644 --- a/static_core/plugins/ets/tests/ets_func_tests/escompat/JsonTest.ets +++ b/static_core/plugins/ets/tests/ets_func_tests/escompat/JsonTest.ets @@ -32,17 +32,17 @@ function testNull(): int { function testBoolean(): int { let booleanType = Type.of(new Boolean() as Object) - return test((JSON.parse("true", booleanType) as Boolean).unboxed() == true, "Boolean(true)") + - test((JSON.parse("false", booleanType) as Boolean).unboxed() == false, "Boolean(false)") + return test((JSON.parse("true", booleanType) as Boolean).toBoolean() == true, "Boolean(true)") + + test((JSON.parse("false", booleanType) as Boolean).toBoolean() == false, "Boolean(false)") } function testDouble(): int { let doubleType = Type.of(new Double() as Object) - return test((JSON.parse("0", doubleType) as Double).unboxed() == 0, "Double(0)") + - test((JSON.parse("1", doubleType) as Double).unboxed() == 1, "Double(1)") + - test((JSON.parse("-1", doubleType) as Double).unboxed() == -1, "Double(-1)") + - test((JSON.parse("2.72182", doubleType) as Double).unboxed() == 2.72182, "Double(2.72182)") + - test((JSON.parse("-2.72182", doubleType) as Double).unboxed() == -2.72182, "Double(-2.72182)") + return test((JSON.parse("0", doubleType) as Double).toDouble() == 0, "Double(0)") + + test((JSON.parse("1", doubleType) as Double).toDouble() == 1, "Double(1)") + + test((JSON.parse("-1", doubleType) as Double).toDouble() == -1, "Double(-1)") + + test((JSON.parse("2.72182", doubleType) as Double).toDouble() == 2.72182, "Double(2.72182)") + + test((JSON.parse("-2.72182", doubleType) as Double).toDouble() == -2.72182, "Double(-2.72182)") } function testStringWithEscape01(): int { diff --git a/static_core/plugins/ets/tests/ets_func_tests/escompat/RegExpReplaceFunctionTest.ets b/static_core/plugins/ets/tests/ets_func_tests/escompat/RegExpReplaceFunctionTest.ets index 0d489a861c..62093b3fae 100644 --- a/static_core/plugins/ets/tests/ets_func_tests/escompat/RegExpReplaceFunctionTest.ets +++ b/static_core/plugins/ets/tests/ets_func_tests/escompat/RegExpReplaceFunctionTest.ets @@ -26,7 +26,7 @@ function test1(shor: String): int { return ans; } failure += checkTestResult(shor.replace("x", lambda), "0axbxcx") - failure += checkTestResult(ctr.unboxed(), 1) + failure += checkTestResult(ctr.toInt(), 1) return failure } @@ -43,7 +43,7 @@ function test2(shor: String): int { return ans; } failure += checkTestResult(shor.replace(new RegExp("x"), lambda), "0axbxcx") - failure += checkTestResult(ctr.unboxed(), 1) + failure += checkTestResult(ctr.toInt(), 1) return failure } @@ -54,14 +54,14 @@ function test3(shor: String): int { let lambda : (str: String, args: Object[]) => String = (str: String, args: Object[]) : String => { failure += checkTestResult(str, "x") - failure += checkTestResult(args[0] as Double, new Double((ctr.unboxed() * 2).toDouble())) + failure += checkTestResult(args[0] as Double, new Double((ctr.toInt() * 2).toDouble())) failure += checkTestResult(args[1].toString(), shor) let ans = ctr.toString(); ctr++; return ans; } failure += checkTestResult(shor.replace(new RegExp("x", "g"), lambda), "0a1b2c3") - failure += checkTestResult(ctr.unboxed(), 4) + failure += checkTestResult(ctr.toInt(), 4) return failure } @@ -73,15 +73,15 @@ function test4(shor: String): int { let lambda : (str: String, args: Object[]) => String = (str: String, args: Object[]) : String => { failure += checkTestResult(str, "x") failure += checkTestResult(args[0].toString(), "x") - failure += checkTestResult(args[1].toString(), test[ctr.unboxed()]) - failure += checkTestResult(args[2] as Double, new Double((ctr.unboxed() * 2).toDouble())) + failure += checkTestResult(args[1].toString(), test[ctr.toInt()]) + failure += checkTestResult(args[2] as Double, new Double((ctr.toInt() * 2).toDouble())) failure += checkTestResult(args[3].toString(), shor) let ans = ctr.toString(); ctr++; return ans; } failure += checkTestResult(shor.replace(new RegExp("(x)(?=(.))", "g"), lambda), "0a1b2cx") - failure += checkTestResult(ctr.unboxed(), 3) + failure += checkTestResult(ctr.toInt(), 3) return failure } diff --git a/static_core/plugins/ets/tests/ets_func_tests/std/core/DoubleTest.ets b/static_core/plugins/ets/tests/ets_func_tests/std/core/DoubleTest.ets index b464dd97bb..aeaf29359b 100644 --- a/static_core/plugins/ets/tests/ets_func_tests/std/core/DoubleTest.ets +++ b/static_core/plugins/ets/tests/ets_func_tests/std/core/DoubleTest.ets @@ -134,7 +134,7 @@ function main() { if (force_log) { console.log("[" + test + "]"); } - let ctor_answer = (new Number(test)).unboxed(); // change to .valueOf to run script in TS + let ctor_answer = (new Number(test)).toDouble(); // change to .valueOf to run script in TS let parse_answer = Number.parseFloat(test); fails += check(ctor_answer, correct_cts[test_id], "Number(" + test + ")"); fails += check(parse_answer, correct_pfs[test_id], "parseFloat(" + test + ")"); diff --git a/static_core/plugins/ets/tests/ets_func_tests/std/core/TypeFieldTest.ets b/static_core/plugins/ets/tests/ets_func_tests/std/core/TypeFieldTest.ets index ff261a8a66..24e6943aa3 100644 --- a/static_core/plugins/ets/tests/ets_func_tests/std/core/TypeFieldTest.ets +++ b/static_core/plugins/ets/tests/ets_func_tests/std/core/TypeFieldTest.ets @@ -108,7 +108,7 @@ function testField(): int { test(zf.getType() == DoubleType.VAL, " Type: double") + test(zf.getAttributes() == Attributes.STATIC, " static attribute") + test(zf.getAccessModifier() == AccessModifier.PUBLIC, " public access modififer") + - test((zf.getStaticValue() as Double).unboxed() == Point3D.ZERO, " static value") + + test((zf.getStaticValue() as Double).toDouble() == Point3D.ZERO, " static value") + test(!zf.isReadonly(), " not readonly") + test(!isInherited(zf, pt), " not inherited") + test(!isOverrided(zf, pt), " not override") + diff --git a/static_core/plugins/ets/tests/interop_js/tests/primitive/ts_to_ets/primitive.ets b/static_core/plugins/ets/tests/interop_js/tests/primitive/ts_to_ets/primitive.ets index f25d0493c2..722872fbbc 100644 --- a/static_core/plugins/ets/tests/interop_js/tests/primitive/ts_to_ets/primitive.ets +++ b/static_core/plugins/ets/tests/interop_js/tests/primitive/ts_to_ets/primitive.ets @@ -98,7 +98,7 @@ function checkChar(val: char) { } function checkCharBoxed(val: Char) { - arktest.assertTrue(val.unboxed() == c'1') + arktest.assertTrue(val.toChar() == c'1') } function checkString(val: string) { diff --git a/static_core/plugins/ets/tests/stdlib-templates/std/core/list.std_core_boolean_instance.yaml b/static_core/plugins/ets/tests/stdlib-templates/std/core/list.std_core_boolean_instance.yaml index 168f92584f..6fab5d5de7 100644 --- a/static_core/plugins/ets/tests/stdlib-templates/std/core/list.std_core_boolean_instance.yaml +++ b/static_core/plugins/ets/tests/stdlib-templates/std/core/list.std_core_boolean_instance.yaml @@ -11,21 +11,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -- { - method_name: unboxed, - object_type: Boolean, - init_object_data_type: "FixedArray", - init_object_data: "[true, false]", - param_init_data_types: {} , - param_types: {}, - param_nature: {}, - method_return_type: boolean, - expected_data_item_type: boolean, - expected_data_type: "FixedArray", - param_list: {}, - expected_test_data: "[true, false]", - verify_test_result_function: comparePrimitiveValue, - } - { method_name: valueOf, object_type: Boolean, diff --git a/static_core/plugins/ets/tests/stdlib-templates/std/core/list.std_core_byte_instance.yaml b/static_core/plugins/ets/tests/stdlib-templates/std/core/list.std_core_byte_instance.yaml index 3b256a8943..36a11314b6 100644 --- a/static_core/plugins/ets/tests/stdlib-templates/std/core/list.std_core_byte_instance.yaml +++ b/static_core/plugins/ets/tests/stdlib-templates/std/core/list.std_core_byte_instance.yaml @@ -11,20 +11,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -- { - method_name: unboxed, - object_type: Byte, - init_object_data_type: "FixedArray", - init_object_data: "[0 as byte, 1 as byte, Byte.MIN_VALUE.toByte(), Byte.MAX_VALUE.toByte()]", - param_init_data_types: {} , - param_types: {}, - method_return_type: byte, - expected_data_item_type: byte, - expected_data_type: "FixedArray", - param_list: {}, - expected_test_data: "[0 as byte, 1 as byte, Byte.MIN_VALUE.toByte(), Byte.MAX_VALUE.toByte()]", - verify_test_result_function: comparePrimitiveValue, - } - { method_name: toByte, object_type: Byte, diff --git a/static_core/plugins/ets/tests/stdlib-templates/std/core/list.std_core_char_instance.yaml b/static_core/plugins/ets/tests/stdlib-templates/std/core/list.std_core_char_instance.yaml index 6f3a68b7e7..0fea137613 100644 --- a/static_core/plugins/ets/tests/stdlib-templates/std/core/list.std_core_char_instance.yaml +++ b/static_core/plugins/ets/tests/stdlib-templates/std/core/list.std_core_char_instance.yaml @@ -11,21 +11,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -- { - method_name: unboxed, - object_type: Char, - init_object_data_type: "FixedArray", - init_object_type: char, - init_object_type_nature: primitive, - param_init_data_types: {} , - param_types: {}, - param_list: {}, - method_return_type: char, - init_object_data: "[c'x', c'X']", - expected_data_type: "FixedArray", - expected_test_data: "[c'x', c'X']", - verify_test_result_function: comparePrimitiveValue - } - { method_name: toString, object_type: Char, @@ -238,7 +223,7 @@ result_nature: primitive, result_storage: this, result_type: char, - result_retrieve_function: "unboxed()", + result_retrieve_function: "toChar()", expected_data_item_type: char, expected_data_type: "FixedArray", param_list: {}, @@ -258,7 +243,7 @@ result_nature: primitive, result_type: char, result_storage: this, - result_retrieve_function: "unboxed()", + result_retrieve_function: "toChar()", expected_data_item_type: char, expected_data_type: "FixedArray", param_list: {}, diff --git a/static_core/plugins/ets/tests/stdlib-templates/std/core/list.std_core_double_instance.yaml b/static_core/plugins/ets/tests/stdlib-templates/std/core/list.std_core_double_instance.yaml index 948260a9bc..9470583a67 100644 --- a/static_core/plugins/ets/tests/stdlib-templates/std/core/list.std_core_double_instance.yaml +++ b/static_core/plugins/ets/tests/stdlib-templates/std/core/list.std_core_double_instance.yaml @@ -11,21 +11,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -- { - method_name: unboxed, - object_type: Double, - init_object_data_type: "FixedArray", - init_object_type: double, - init_object_type_nature: primitive, - param_init_data_types: {}, - param_types: {}, - param_list: {}, - method_return_type: double, - init_object_data: "[0 as double, 1 as double, Byte.MIN_VALUE.toDouble(), Byte.MAX_VALUE.toDouble()]", - expected_data_type: "FixedArray", - expected_test_data: "[0 as double, 1 as double, Byte.MIN_VALUE.toDouble(), Byte.MAX_VALUE.toDouble()]", - verify_test_result_function: compareFloatPointValue - } - { method_name: toByte, object_type: Double, diff --git a/static_core/plugins/ets/tests/stdlib-templates/std/core/list.std_core_float_instance.yaml b/static_core/plugins/ets/tests/stdlib-templates/std/core/list.std_core_float_instance.yaml index 73209dc6fe..b052451fb2 100644 --- a/static_core/plugins/ets/tests/stdlib-templates/std/core/list.std_core_float_instance.yaml +++ b/static_core/plugins/ets/tests/stdlib-templates/std/core/list.std_core_float_instance.yaml @@ -11,20 +11,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -- { - method_name: unboxed, - object_type: Float, - init_object_data_type: "FixedArray", - init_object_type: float, - param_init_data_types: {}, - param_types: {}, - param_list: {}, - method_return_type: float, - init_object_data: "[0.0f, 1.0f, Float.MIN_VALUE, Float.MAX_VALUE]", - expected_data_type: "FixedArray", - expected_test_data: "[0.0f, 1.0f, Float.MIN_VALUE, Float.MAX_VALUE]", - verify_test_result_function: compareFloatPointValue - } - { method_name: toByte, object_type: Float, diff --git a/static_core/plugins/ets/tests/stdlib-templates/std/core/list.std_core_int_instance.yaml b/static_core/plugins/ets/tests/stdlib-templates/std/core/list.std_core_int_instance.yaml index fd961790b9..8149b1678b 100644 --- a/static_core/plugins/ets/tests/stdlib-templates/std/core/list.std_core_int_instance.yaml +++ b/static_core/plugins/ets/tests/stdlib-templates/std/core/list.std_core_int_instance.yaml @@ -11,20 +11,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -- { - method_name: unboxed, - object_type: Int, - init_object_data_type: "FixedArray", - init_object_data: "[0 as int, 1 as int, Int.MIN_VALUE.toInt(), Int.MAX_VALUE.toInt()]", - param_init_data_types: {} , - param_types: {}, - method_return_type: int, - expected_data_item_type: int, - expected_data_type: "FixedArray", - param_list: {}, - expected_test_data: "[0 as int, 1 as int, Int.MIN_VALUE.toInt(), Int.MAX_VALUE.toInt()]", - verify_test_result_function: comparePrimitiveValue, - } - { method_name: toByte, object_type: Int, diff --git a/static_core/plugins/ets/tests/stdlib-templates/std/core/list.std_core_long_instance.yaml b/static_core/plugins/ets/tests/stdlib-templates/std/core/list.std_core_long_instance.yaml index 35bfbfe591..ef4e431968 100644 --- a/static_core/plugins/ets/tests/stdlib-templates/std/core/list.std_core_long_instance.yaml +++ b/static_core/plugins/ets/tests/stdlib-templates/std/core/list.std_core_long_instance.yaml @@ -11,22 +11,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -- { - method_name: unboxed, - object_type: Long, - init_object_data_type: "FixedArray", - init_object_type: long, - init_object_type_nature: primitive, - param_init_data_types: {} , - param_types: {}, - param_list: {}, - method_return_type: long, - init_object_data: "[0 as long, 1 as int, -1 as int, Long.MIN_VALUE.toLong(), Long.MAX_VALUE.toLong()]", - expected_data_type: "FixedArray", - expected_test_data: "[0 as long, 1 as long, -1 as long, Long.MIN_VALUE.toLong(), Long.MAX_VALUE.toLong()]", - verify_test_result_function: comparePrimitiveValue - } - - { method_name: toByte, diff --git a/static_core/plugins/ets/tests/stdlib-templates/std/core/list.std_core_short_instance.yaml b/static_core/plugins/ets/tests/stdlib-templates/std/core/list.std_core_short_instance.yaml index 9af800eef1..5143199030 100644 --- a/static_core/plugins/ets/tests/stdlib-templates/std/core/list.std_core_short_instance.yaml +++ b/static_core/plugins/ets/tests/stdlib-templates/std/core/list.std_core_short_instance.yaml @@ -11,20 +11,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -- { - method_name: unboxed, - object_type: Short, - init_object_data_type: "FixedArray", - init_object_data: "[0 as short, 1 as short, Short.MIN_VALUE.toShort(), Short.MAX_VALUE.toShort()]", - param_init_data_types: {} , - param_types: {}, - method_return_type: short, - expected_data_item_type: short, - expected_data_type: "FixedArray", - param_list: {}, - expected_test_data: "[0 as short, 1 as short, Short.MIN_VALUE.toShort(), Short.MAX_VALUE.toShort()]", - verify_test_result_function: comparePrimitiveValue, - } - { method_name: toByte, object_type: Short, diff --git a/static_core/plugins/ets/tests/stdlib-templates/utils/test_constructor.j2 b/static_core/plugins/ets/tests/stdlib-templates/utils/test_constructor.j2 index 4249a351e1..f11b78a3f2 100644 --- a/static_core/plugins/ets/tests/stdlib-templates/utils/test_constructor.j2 +++ b/static_core/plugins/ets/tests/stdlib-templates/utils/test_constructor.j2 @@ -89,7 +89,7 @@ function testConstructor(initDataIdx : int) : boolean { let object4Copy : {{.item.object_type}} = new {{.item.object_type}}({{.item.init_object_param_list.keys()|list|join(', ')}}); let actualClone : {{.item.object_type}} = new {{.item.object_type}}(object4Copy); // console.print("actualClone:"); - // console.print(actualClone.unboxed()); + // console.print(actualClone); // console.print(";"); if ({{.item.verify_test_result_function}}(actualClone, TEST_DATA_EXPECTED[initDataIdx])) { resultCopy = true diff --git a/static_core/plugins/ets/tests/stdlib-templates/utils/test_verifier_lib.j2 b/static_core/plugins/ets/tests/stdlib-templates/utils/test_verifier_lib.j2 index d645d8003c..5872ff000f 100644 --- a/static_core/plugins/ets/tests/stdlib-templates/utils/test_verifier_lib.j2 +++ b/static_core/plugins/ets/tests/stdlib-templates/utils/test_verifier_lib.j2 @@ -61,7 +61,7 @@ function compareFloatPointValue(left : double, right : double) : boolean { {%- if item.method_return_type == "Char" or item.method_return_type == "Boolean" or item.method_return_type == "Byte" or item.method_return_type == "Short" or item.method_return_type == "Int" or item.method_return_type == "Long" or item.method_return_type == "Float" or item.method_return_type == "Double" %} function compareWrapperObjectValue(actual : {{.item.method_return_type}}, expected : {{.item.expected_data_item_type}}) : boolean { let actual2 : {{.item.expected_data_item_type}}; - actual2 = actual.unboxed(); + actual2 = actual; {%- if item.method_return_type == "Float" or item.method_return_type == "Double" %} return compareFloatPointValue(actual2, expected); {% else %} diff --git a/static_core/tests/verifier-tests/checkcast_null_acctype.pa b/static_core/tests/verifier-tests/checkcast_null_acctype.pa index 9d7c2236ef..dae15cf05f 100644 --- a/static_core/tests/verifier-tests/checkcast_null_acctype.pa +++ b/static_core/tests/verifier-tests/checkcast_null_acctype.pa @@ -19,11 +19,11 @@ sta v0 lda.null checkcast panda.Object - call.virt.acc.short A.unboxed:(A), v0, 0x0 + call.virt.acc.short A.toShort:(A), v0, 0x0 return } -.function i32 A.unboxed(A a0) { +.function i32 A.toShort(A a0) { ldai 0x1 return } \ No newline at end of file -- Gitee