From a106568c5828f2f769ba57f8e5e691cc8da7e777 Mon Sep 17 00:00:00 2001 From: Orange_66 Date: Wed, 10 Sep 2025 15:30:22 +0800 Subject: [PATCH] Rallback overload Issue: https://gitee.com/openharmony/arkcompiler_runtime_core/issues/ICXB0Y Signed-off-by: Orange_66 --- .../plugins/ets/sdk/api/@ohos.util.stream.ets | 9 +- .../ets/sdk/arkts/@arkts.math.Decimal.ets | 155 ++++-------------- 2 files changed, 33 insertions(+), 131 deletions(-) diff --git a/static_core/plugins/ets/sdk/api/@ohos.util.stream.ets b/static_core/plugins/ets/sdk/api/@ohos.util.stream.ets index c67dbc62e4..47f2d45090 100755 --- a/static_core/plugins/ets/sdk/api/@ohos.util.stream.ets +++ b/static_core/plugins/ets/sdk/api/@ohos.util.stream.ets @@ -1118,7 +1118,7 @@ export namespace stream { * @param { ReadableOptions } options - Provide options. * @throws { BusinessError } 401 - Parameter error. */ - constructor fromOptions(options: ReadableOptions) { + constructor(options: ReadableOptions) { this.initializeMembers(); if (options.encoding) { @@ -1135,13 +1135,6 @@ export namespace stream { } } - /** - * The Readable constructor. - * - * @overload { fromOptions } - */ - overload constructor { fromOptions } - private initializeMembers(): void { this.listener = new EventEmitter(); this.errorEmitted = false; diff --git a/static_core/plugins/ets/sdk/arkts/@arkts.math.Decimal.ets b/static_core/plugins/ets/sdk/arkts/@arkts.math.Decimal.ets index b31ead78fc..a7b98dcb66 100644 --- a/static_core/plugins/ets/sdk/arkts/@arkts.math.Decimal.ets +++ b/static_core/plugins/ets/sdk/arkts/@arkts.math.Decimal.ets @@ -291,7 +291,7 @@ export class Decimal { * * @returns { string } the string type */ - public toBinaryWithNoArg(): string { + public toBinary(): string { return this.toStringBinary(2); } @@ -303,7 +303,7 @@ export class Decimal { * @returns { string } the string type * @throws { BusinessError } 10200001 - The value of `significantDigits` is out of range. */ - public toBinaryWithSignificantDigits(significantDigits: double): string { + public toBinary(significantDigits: double): string { return this.toStringBinary(2, significantDigits); } @@ -316,23 +316,16 @@ export class Decimal { * @returns { string } the string type * @throws { BusinessError } 10200001 - The value of `significantDigits | rounding` is out of range. */ - public toBinaryWithSignificantDigitsRounding(significantDigits: double, rounding: Rounding): string { + public toBinary(significantDigits: double, rounding: Rounding): string { return this.toStringBinary(2, significantDigits, rounding); } - /** - * Return a string representing the value of this Decimal in base 2. - * - * @overload { toBinaryWithNoArg, toBinaryWithSignificantDigits, toBinaryWithSignificantDigitsRounding } - */ - overload toBinary { toBinaryWithNoArg, toBinaryWithSignificantDigits, toBinaryWithSignificantDigitsRounding } - /** * Return a string representing the value of this Decimal in base 8. * * @returns { string } the string type */ - public toOctalWithNoArg(): string { + public toOctal(): string { return this.toStringBinary(8); } @@ -343,7 +336,7 @@ export class Decimal { * @returns { string } the string type * @throws { BusinessError } 10200001 - The value of `significantDigits` is out of range. */ - public toOctalSignificantDigits(significantDigits: double): string { + public toOctal(significantDigits: double): string { return this.toStringBinary(8, significantDigits); } @@ -356,23 +349,16 @@ export class Decimal { * @returns { string } the string type * @throws { BusinessError } 10200001 - The value of `significantDigits | rounding` is out of range. */ - public toOctalWithSignificantDigitsRounding(significantDigits: double, rounding: Rounding): string { + public toOctal(significantDigits: double, rounding: Rounding): string { return this.toStringBinary(8, significantDigits, rounding); } - /** - * Return a string representing the value of this Decimal in base 8. - * - * @overload { toOctalWithNoArg, toOctalSignificantDigits, toOctalWithSignificantDigitsRounding } - */ - overload toOctal { toOctalWithNoArg, toOctalSignificantDigits, toOctalWithSignificantDigitsRounding } - /** * Return a string representing the value of this Decimal in base 16 * * @returns { string } the string type */ - public toHexadecimalWithNoArg(): string { + public toHexadecimal(): string { return this.toStringBinary(16); } @@ -383,7 +369,7 @@ export class Decimal { * @returns { string } the string type * @throws { BusinessError } 10200001 - The value of `significantDigits` is out of range. */ - public toHexadecimalWithSignificantDigits(significantDigits: double): string { + public toHexadecimal(significantDigits: double): string { return this.toStringBinary(16, significantDigits); } @@ -396,24 +382,17 @@ export class Decimal { * @returns { string } the string type * @throws { BusinessError } 10200001 - The value of `significantDigits | rounding` is out of range. */ - public toHexadecimalWithSignificantDigitsRounding(significantDigits: double, rounding: Rounding): string { + public toHexadecimal(significantDigits: double, rounding: Rounding): string { return this.toStringBinary(16, significantDigits, rounding); } - /** - * Return a string representing the value of this Decimal in base 16. - * - * @overload { toHexadecimalWithNoArg, toHexadecimalWithSignificantDigits, toHexadecimalWithSignificantDigitsRounding } - */ - overload toHexadecimal { toHexadecimalWithNoArg, toHexadecimalWithSignificantDigits, toHexadecimalWithSignificantDigitsRounding } - /** * Return an array representing the value of this Decimal as a simple fraction with an integer * numerator and an integer denominator. * * @returns { Decimal[] } the Decimal[] type */ - public toFractionWithNoArg(): Decimal[] { + public toFraction(): Decimal[] { return this.fraction(); } @@ -425,24 +404,16 @@ export class Decimal { * @param { Value } maxDenominator {double | string | Decimal} * @returns { Decimal[] } the Decimal[] type */ - public toFractionWithMaxDenominator(maxDenominator: Value): Decimal[] { + public toFraction(maxDenominator: Value): Decimal[] { return this.fraction(maxDenominator); } - /** - * Return an array representing the value of this Decimal as a simple fraction with an integer - * numerator and an integer denominator. - * - * @overload { toFractionWithNoArg, toFractionWithMaxDenominator } - */ - overload toFraction { toFractionWithNoArg, toFractionWithMaxDenominator } - /** * Return a new Decimal whose value is the value of this Decimal. * * @returns { Decimal } the Decimal type */ - public toDecimalPlacesWithNoArg(): Decimal { + public toDecimalPlaces(): Decimal { return new Decimal(this); } @@ -453,7 +424,7 @@ export class Decimal { * @param { double } decimalPlaces Significant digits. Integer, 1 to MAX_DIGITS inclusive. * @returns { Decimal } the Decimal type */ - public toDecimalPlacesWithDecimalPlaces(decimalPlaces: double): Decimal { + public toDecimalPlaces(decimalPlaces: double): Decimal { return this.toDecimalPlaces(decimalPlaces, Decimal.rounding); } @@ -465,26 +436,19 @@ export class Decimal { * @param { Rounding } rounding Rounding mode. Integer, 0 to 8 inclusive. * @returns { Decimal } the Decimal type */ - public toDecimalPlacesWithDecimalPlacesRounding(decimalPlaces: double, rounding: Rounding): Decimal { + public toDecimalPlaces(decimalPlaces: double, rounding: Rounding): Decimal { let decimal = this.toDecimalPlaces(); Utils.checkInt32(decimalPlaces, 0, MAX_DIGITS); Utils.checkInt32(rounding, 0, 8); return Utils.finalise(decimal, decimalPlaces + decimal.e + 1, rounding); } - /** - * Return a new Decimal with various types of value. - * - * @overload { toDecimalPlacesWithNoArg, toDecimalPlacesWithDecimalPlaces, toDecimalPlacesWithDecimalPlacesRounding } - */ - overload toDecimalPlaces { toDecimalPlacesWithNoArg, toDecimalPlacesWithDecimalPlaces, toDecimalPlacesWithDecimalPlacesRounding } - /** * Return a string representing the value of this Decimal in exponential notation. * * @returns { string } the string type */ - public toExponentialWithNoArg(): string { + public toExponential(): string { let str = this.finiteToString(true); return this.isNegative() && !this.isZero() ? '-' + str : str; } @@ -497,7 +461,7 @@ export class Decimal { * @returns { string } the string type * @throws { BusinessError } 10200001 - The value of `decimalPlaces` is out of range. */ - public toExponentialWithDecimalPlaces(decimalPlaces: double): string { + public toExponential(decimalPlaces: double): string { return this.toExponential(decimalPlaces, Decimal.rounding); } @@ -510,7 +474,7 @@ export class Decimal { * @returns { string } the string type * @throws { BusinessError } 10200001 - The value of `decimalPlaces | rounding` is out of range. */ - public toExponentialWithDecimalPlacesRounding(decimalPlaces: double, rounding: Rounding): string { + public toExponential(decimalPlaces: double, rounding: Rounding): string { Utils.checkInt32(decimalPlaces, 0, MAX_DIGITS); Utils.checkInt32(rounding, 0, 8); let x = Utils.finalise(new Decimal(this), decimalPlaces + 1, rounding); @@ -518,19 +482,12 @@ export class Decimal { return x.isNegative() && !x.isZero() ? '-' + str : str; } - /** - * Return a string representing the value of this Decimal in exponential notation. - * - * @overload { toExponentialWithNoArg, toExponentialWithDecimalPlaces, toExponentialWithDecimalPlacesRounding } - */ - overload toExponential { toExponentialWithNoArg, toExponentialWithDecimalPlaces, toExponentialWithDecimalPlacesRounding } - /** * Return a string representing the value of this Decimal in normal (fixed-point). * * @returns { string } the string type */ - public toFixedWithNoArg(): string { + public toFixed(): string { let str = this.finiteToString(false); return this.isNegative() && !this.isZero() ? '-' + str : str; } @@ -543,7 +500,7 @@ export class Decimal { * @returns { string } the string type * @throws { BusinessError } 10200001 - The value of `decimalPlaces` is out of range. */ - public toFixedWithDecimalPlaces(decimalPlaces: double): string { + public toFixed(decimalPlaces: double): string { return this.toFixed(decimalPlaces, Decimal.rounding); } @@ -556,7 +513,7 @@ export class Decimal { * @returns { string } the string type * @throws { BusinessError } 10200001 - The value of `decimalPlaces | rounding` is out of range. */ - public toFixedWithDecimalPlacesRounding(decimalPlaces: double, rounding: Rounding): string { + public toFixed(decimalPlaces: double, rounding: Rounding): string { Utils.checkInt32(decimalPlaces, 0, MAX_DIGITS); Utils.checkInt32(rounding, 0, 8); let y = Utils.finalise(new Decimal(this), decimalPlaces + this.e + 1, rounding); @@ -564,20 +521,13 @@ export class Decimal { return this.isNegative() && !this.isZero() ? '-' + str : str; } - /** - * Return a string representing the value of this Decimal in normal (fixed-point). - * - * @overload { toFixedWithNoArg, toFixedWithDecimalPlaces, toFixedWithDecimalPlacesRounding } - */ - overload toFixed { toFixedWithNoArg, toFixedWithDecimalPlaces, toFixedWithDecimalPlacesRounding } - /** * Returns a new Decimal whose value is the nearest multiple of `n`. * * @param { Value } n {double | string | Decimal} * @returns { Decimal } the Decimal type */ - public toNearestWithN(n: Value): Decimal { + public toNearest(n: Value): Decimal { return this.toNearest(n, Decimal.rounding); } @@ -590,7 +540,7 @@ export class Decimal { * @returns { Decimal } the Decimal type * @throws { BusinessError } 10200001 - The value of `rounding` is out of range. */ - public toNearestWithNRounding(n: Value, rounding: Rounding): Decimal { + public toNearest(n: Value, rounding: Rounding): Decimal { let x = new Decimal(this); let y = new Decimal(n); Utils.checkInt32(rounding, 0, 8); @@ -623,19 +573,12 @@ export class Decimal { return x; } - /** - * Returns a new Decimal with various types of value. - * - * @overload { toNearestWithN, toNearestWithNRounding } - */ - overload toNearest { toNearestWithN, toNearestWithNRounding } - /** * Return a string representing the value of this Decimal. * * @returns { string } the string type */ - public toPrecisionWithNoArg(): string { + public toPrecision(): string { let str = this.finiteToString(this.e <= Decimal.toExpNeg || this.e >= Decimal.toExpPos); return this.isNegative() && !this.isZero() ? '-' + str : str; } @@ -647,7 +590,7 @@ export class Decimal { * @returns { string } the string type * @throws { BusinessError } 10200001 - The value of `significantDigits` is out of range. */ - public toPrecisionWithSignificantDigits(significantDigits: double): string { + public toPrecision(significantDigits: double): string { return this.toPrecision(significantDigits, Decimal.rounding); } @@ -660,7 +603,7 @@ export class Decimal { * @returns { string } the string type * @throws { BusinessError } 10200001 - The value of `significantDigits | rounding` is out of range. */ - public toPrecisionWithSignificantDigitsRounding(significantDigits: double, rounding: Rounding): string { + public toPrecision(significantDigits: double, rounding: Rounding): string { Utils.checkInt32(significantDigits, 1, MAX_DIGITS); Utils.checkInt32(rounding, 0, 8); let x = Utils.finalise(new Decimal(this), significantDigits, rounding); @@ -668,19 +611,12 @@ export class Decimal { return x.isNegative() && !x.isZero() ? '-' + str : str; } - /** - * Return a string representing the value of this Decimal. - * - * @overload { toPrecisionWithNoArg, toPrecisionWithSignificantDigits, toPrecisionWithSignificantDigitsRounding } - */ - overload toPrecision { toPrecisionWithNoArg, toPrecisionWithSignificantDigits, toPrecisionWithSignificantDigitsRounding } - /** * Return a new Decimal whose value is the value of this Decimal. * * @returns { Decimal } the Decimal type */ - public toSignificantDigitsWithNoArg(): Decimal { + public toSignificantDigits(): Decimal { return Utils.finalise(new Decimal(this), Decimal.precision, Decimal.rounding); } @@ -692,7 +628,7 @@ export class Decimal { * @returns { Decimal } the Decimal type * @throws { BusinessError } 10200001 - The value of `significantDigits` is out of range. */ - public toSignificantDigitsWithSignificantDigits(significantDigits: double): Decimal { + public toSignificantDigits(significantDigits: double): Decimal { return this.toSignificantDigits(significantDigits, Decimal.rounding); } @@ -705,19 +641,12 @@ export class Decimal { * @returns { Decimal } the Decimal type * @throws { BusinessError } 10200001 - The value of `significantDigits | rounding` is out of range. */ - public toSignificantDigitsWithSignificantDigitsRounding(significantDigits: double, rounding: Rounding): Decimal { + public toSignificantDigits(significantDigits: double, rounding: Rounding): Decimal { Utils.checkInt32(significantDigits, 1, MAX_DIGITS); Utils.checkInt32(rounding, 0, 8); return Utils.finalise(new Decimal(this), significantDigits, rounding); } - /** - * Return a new Decimal whose value is the value of this Decimal. - * - * @overload { toSignificantDigitsWithNoArg, toSignificantDigitsWithSignificantDigits, toSignificantDigitsWithSignificantDigitsRounding } - */ - overload toSignificantDigits { toSignificantDigitsWithNoArg, toSignificantDigitsWithSignificantDigits, toSignificantDigitsWithSignificantDigitsRounding } - /** * Return the value of this Decimal converted to a number primitive. Zero keeps its sign. * @@ -780,7 +709,7 @@ export class Decimal { * * @returns { double } the number type */ - public precisionWithNoArg(): double { + public precision(): double { let result: double; if (this.digits) { result = Utils.getPrecision(this.digits!); @@ -799,7 +728,7 @@ export class Decimal { * @returns { double } the number type * @throws { BusinessError } 10200001 - The value of `includeZeros` is out of range. */ - public precisionWithIncludeZeros(includeZeros: boolean | int): double { + public precision(includeZeros: boolean | int): double { let result: double; if (includeZeros != undefined && includeZeros !== !!includeZeros && includeZeros !== 1 && includeZeros !== 0) { throw Utils.createBusinessError(RANGE_ERROR_CODE, @@ -817,13 +746,6 @@ export class Decimal { return result; } - /** - * Return the number of significant digits of the value of this Decimal. - * - * @overload { precisionWithNoArg, precisionWithIncludeZeros } - */ - overload precision { precisionWithNoArg, precisionWithIncludeZeros } - /** * Return a new Decimal whose value is the absolute value of `n`. * @@ -1307,7 +1229,7 @@ export class Decimal { * @returns { Decimal } the Decimal type * @throws { BusinessError } 10200061 - Crypto unavailable */ - static randomWithNoArg(): Decimal { + static random(): Decimal { return Utils.random(); } @@ -1319,23 +1241,10 @@ export class Decimal { * @returns { Decimal } the Decimal type * @throws { BusinessError } 10200061 - Crypto unavailable */ - static randomWithSignificantDigits(significantDigits: double): Decimal { + static random(significantDigits: double): Decimal { return Utils.random(significantDigits); } - /** - * Returns a new Decimal with a random value equal to or greater than 0 and less than 1. - * - * @overload { randomWithNoArg, randomWithSignificantDigits } - * @static - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since 20 - * @arkts 1.2 - */ - static overload random { randomWithNoArg, randomWithSignificantDigits } - /** * Return the sign of the passed value to the method. * 1 if x > 0, -- Gitee