Deprecate Char-to-Number conversions in stdlib (JVM and JS)
- Int.toChar was left non-deprecated because the replacement is not intrinsic yet. - Number.toChar was left non-deprecated because otherwise the deprecation propagates to the override, Int.toChar. KT-23451
This commit is contained in:
+11
-11
@@ -200,7 +200,7 @@ public final class Byte : R|kotlin/Number|, R|kotlin/Comparable<kotlin/Byte>|, R
|
||||
|
||||
public open fun toByte(): R|kotlin/Byte|
|
||||
|
||||
public open fun toChar(): R|kotlin/Char|
|
||||
@R|kotlin/Deprecated|(message = String(Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.), replaceWith = @R|kotlin/ReplaceWith|(imports = <implicitArrayOf>(), expression = String(this.toInt().toChar())) ) @R|kotlin/DeprecatedSinceKotlin|(warningSince = String(1.5)) public open fun toChar(): R|kotlin/Char|
|
||||
|
||||
public open fun toDouble(): R|kotlin/Double|
|
||||
|
||||
@@ -288,19 +288,19 @@ public final class Char : R|kotlin/Comparable<kotlin/Char>|, R|java/io/Serializa
|
||||
|
||||
public final operator fun rangeTo(other: R|kotlin/Char|): R|kotlin/ranges/CharRange|
|
||||
|
||||
public final fun toByte(): R|kotlin/Byte|
|
||||
@R|kotlin/Deprecated|(message = String(Conversion of Char to Number is deprecated. Use Char.code property instead.), replaceWith = @R|kotlin/ReplaceWith|(imports = <implicitArrayOf>(), expression = String(this.code.toByte())) ) @R|kotlin/DeprecatedSinceKotlin|(warningSince = String(1.5)) public final fun toByte(): R|kotlin/Byte|
|
||||
|
||||
public final fun toChar(): R|kotlin/Char|
|
||||
|
||||
public final fun toDouble(): R|kotlin/Double|
|
||||
@R|kotlin/Deprecated|(message = String(Conversion of Char to Number is deprecated. Use Char.code property instead.), replaceWith = @R|kotlin/ReplaceWith|(imports = <implicitArrayOf>(), expression = String(this.code.toDouble())) ) @R|kotlin/DeprecatedSinceKotlin|(warningSince = String(1.5)) public final fun toDouble(): R|kotlin/Double|
|
||||
|
||||
public final fun toFloat(): R|kotlin/Float|
|
||||
@R|kotlin/Deprecated|(message = String(Conversion of Char to Number is deprecated. Use Char.code property instead.), replaceWith = @R|kotlin/ReplaceWith|(imports = <implicitArrayOf>(), expression = String(this.code.toFloat())) ) @R|kotlin/DeprecatedSinceKotlin|(warningSince = String(1.5)) public final fun toFloat(): R|kotlin/Float|
|
||||
|
||||
public final fun toInt(): R|kotlin/Int|
|
||||
@R|kotlin/Deprecated|(message = String(Conversion of Char to Number is deprecated. Use Char.code property instead.), replaceWith = @R|kotlin/ReplaceWith|(imports = <implicitArrayOf>(), expression = String(this.code)) ) @R|kotlin/DeprecatedSinceKotlin|(warningSince = String(1.5)) public final fun toInt(): R|kotlin/Int|
|
||||
|
||||
public final fun toLong(): R|kotlin/Long|
|
||||
@R|kotlin/Deprecated|(message = String(Conversion of Char to Number is deprecated. Use Char.code property instead.), replaceWith = @R|kotlin/ReplaceWith|(imports = <implicitArrayOf>(), expression = String(this.code.toLong())) ) @R|kotlin/DeprecatedSinceKotlin|(warningSince = String(1.5)) public final fun toLong(): R|kotlin/Long|
|
||||
|
||||
public final fun toShort(): R|kotlin/Short|
|
||||
@R|kotlin/Deprecated|(message = String(Conversion of Char to Number is deprecated. Use Char.code property instead.), replaceWith = @R|kotlin/ReplaceWith|(imports = <implicitArrayOf>(), expression = String(this.code.toShort())) ) @R|kotlin/DeprecatedSinceKotlin|(warningSince = String(1.5)) public final fun toShort(): R|kotlin/Short|
|
||||
|
||||
private constructor(): R|kotlin/Char|
|
||||
|
||||
@@ -486,7 +486,7 @@ public final class Double : R|kotlin/Number|, R|kotlin/Comparable<kotlin/Double>
|
||||
|
||||
@R|kotlin/Deprecated|(message = String(Unclear conversion. To achieve the same result convert to Int explicitly and then to Byte.), replaceWith = @R|kotlin/ReplaceWith|(imports = <implicitArrayOf>(), expression = String(toInt().toByte())) ) @R|kotlin/DeprecatedSinceKotlin|(warningSince = String(1.3), errorSince = String(1.5)) public open fun toByte(): R|kotlin/Byte|
|
||||
|
||||
public open fun toChar(): R|kotlin/Char|
|
||||
@R|kotlin/Deprecated|(message = String(Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.), replaceWith = @R|kotlin/ReplaceWith|(imports = <implicitArrayOf>(), expression = String(this.toInt().toChar())) ) @R|kotlin/DeprecatedSinceKotlin|(warningSince = String(1.5)) public open fun toChar(): R|kotlin/Char|
|
||||
|
||||
public open fun toDouble(): R|kotlin/Double|
|
||||
|
||||
@@ -665,7 +665,7 @@ public final class Float : R|kotlin/Number|, R|kotlin/Comparable<kotlin/Float>|,
|
||||
|
||||
@R|kotlin/Deprecated|(message = String(Unclear conversion. To achieve the same result convert to Int explicitly and then to Byte.), replaceWith = @R|kotlin/ReplaceWith|(imports = <implicitArrayOf>(), expression = String(toInt().toByte())) ) @R|kotlin/DeprecatedSinceKotlin|(warningSince = String(1.3), errorSince = String(1.5)) public open fun toByte(): R|kotlin/Byte|
|
||||
|
||||
public open fun toChar(): R|kotlin/Char|
|
||||
@R|kotlin/Deprecated|(message = String(Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.), replaceWith = @R|kotlin/ReplaceWith|(imports = <implicitArrayOf>(), expression = String(this.toInt().toChar())) ) @R|kotlin/DeprecatedSinceKotlin|(warningSince = String(1.5)) public open fun toChar(): R|kotlin/Char|
|
||||
|
||||
public open fun toDouble(): R|kotlin/Double|
|
||||
|
||||
@@ -976,7 +976,7 @@ public final class Long : R|kotlin/Number|, R|kotlin/Comparable<kotlin/Long>|, R
|
||||
|
||||
public open fun toByte(): R|kotlin/Byte|
|
||||
|
||||
public open fun toChar(): R|kotlin/Char|
|
||||
@R|kotlin/Deprecated|(message = String(Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.), replaceWith = @R|kotlin/ReplaceWith|(imports = <implicitArrayOf>(), expression = String(this.toInt().toChar())) ) @R|kotlin/DeprecatedSinceKotlin|(warningSince = String(1.5)) public open fun toChar(): R|kotlin/Char|
|
||||
|
||||
public open fun toDouble(): R|kotlin/Double|
|
||||
|
||||
@@ -1170,7 +1170,7 @@ public final class Short : R|kotlin/Number|, R|kotlin/Comparable<kotlin/Short>|,
|
||||
|
||||
public open fun toByte(): R|kotlin/Byte|
|
||||
|
||||
public open fun toChar(): R|kotlin/Char|
|
||||
@R|kotlin/Deprecated|(message = String(Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.), replaceWith = @R|kotlin/ReplaceWith|(imports = <implicitArrayOf>(), expression = String(this.toInt().toChar())) ) @R|kotlin/DeprecatedSinceKotlin|(warningSince = String(1.5)) public open fun toChar(): R|kotlin/Char|
|
||||
|
||||
public open fun toDouble(): R|kotlin/Double|
|
||||
|
||||
|
||||
+11
-11
@@ -100,7 +100,7 @@ public final class Byte : kotlin.Number, kotlin.Comparable<kotlin.Byte> {
|
||||
public final operator fun times(/*0*/ other: kotlin.Long): kotlin.Long
|
||||
public final operator fun times(/*0*/ other: kotlin.Short): kotlin.Int
|
||||
public open override /*1*/ fun toByte(): kotlin.Byte
|
||||
public open override /*1*/ fun toChar(): kotlin.Char
|
||||
@kotlin.Deprecated(message = "Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", replaceWith = kotlin.ReplaceWith(expression = "this.toInt().toChar()", imports = {})) @kotlin.DeprecatedSinceKotlin(warningSince = "1.5") public open override /*1*/ fun toChar(): kotlin.Char
|
||||
public open override /*1*/ fun toDouble(): kotlin.Double
|
||||
public open override /*1*/ fun toFloat(): kotlin.Float
|
||||
public open override /*1*/ fun toInt(): kotlin.Int
|
||||
@@ -141,13 +141,13 @@ public final class Char : kotlin.Comparable<kotlin.Char> {
|
||||
public final operator fun minus(/*0*/ other: kotlin.Int): kotlin.Char
|
||||
public final operator fun plus(/*0*/ other: kotlin.Int): kotlin.Char
|
||||
public final operator fun rangeTo(/*0*/ other: kotlin.Char): kotlin.ranges.CharRange
|
||||
public final fun toByte(): kotlin.Byte
|
||||
@kotlin.Deprecated(message = "Conversion of Char to Number is deprecated. Use Char.code property instead.", replaceWith = kotlin.ReplaceWith(expression = "this.code.toByte()", imports = {})) @kotlin.DeprecatedSinceKotlin(warningSince = "1.5") public final fun toByte(): kotlin.Byte
|
||||
public final fun toChar(): kotlin.Char
|
||||
public final fun toDouble(): kotlin.Double
|
||||
public final fun toFloat(): kotlin.Float
|
||||
public final fun toInt(): kotlin.Int
|
||||
public final fun toLong(): kotlin.Long
|
||||
public final fun toShort(): kotlin.Short
|
||||
@kotlin.Deprecated(message = "Conversion of Char to Number is deprecated. Use Char.code property instead.", replaceWith = kotlin.ReplaceWith(expression = "this.code.toDouble()", imports = {})) @kotlin.DeprecatedSinceKotlin(warningSince = "1.5") public final fun toDouble(): kotlin.Double
|
||||
@kotlin.Deprecated(message = "Conversion of Char to Number is deprecated. Use Char.code property instead.", replaceWith = kotlin.ReplaceWith(expression = "this.code.toFloat()", imports = {})) @kotlin.DeprecatedSinceKotlin(warningSince = "1.5") public final fun toFloat(): kotlin.Float
|
||||
@kotlin.Deprecated(message = "Conversion of Char to Number is deprecated. Use Char.code property instead.", replaceWith = kotlin.ReplaceWith(expression = "this.code", imports = {})) @kotlin.DeprecatedSinceKotlin(warningSince = "1.5") public final fun toInt(): kotlin.Int
|
||||
@kotlin.Deprecated(message = "Conversion of Char to Number is deprecated. Use Char.code property instead.", replaceWith = kotlin.ReplaceWith(expression = "this.code.toLong()", imports = {})) @kotlin.DeprecatedSinceKotlin(warningSince = "1.5") public final fun toLong(): kotlin.Long
|
||||
@kotlin.Deprecated(message = "Conversion of Char to Number is deprecated. Use Char.code property instead.", replaceWith = kotlin.ReplaceWith(expression = "this.code.toShort()", imports = {})) @kotlin.DeprecatedSinceKotlin(warningSince = "1.5") public final fun toShort(): kotlin.Short
|
||||
|
||||
public companion object Companion {
|
||||
/*primary*/ private constructor Companion()
|
||||
@@ -276,7 +276,7 @@ public final class Double : kotlin.Number, kotlin.Comparable<kotlin.Double> {
|
||||
public final operator fun times(/*0*/ other: kotlin.Long): kotlin.Double
|
||||
public final operator fun times(/*0*/ other: kotlin.Short): kotlin.Double
|
||||
@kotlin.Deprecated(message = "Unclear conversion. To achieve the same result convert to Int explicitly and then to Byte.", replaceWith = kotlin.ReplaceWith(expression = "toInt().toByte()", imports = {})) @kotlin.DeprecatedSinceKotlin(errorSince = "1.5", warningSince = "1.3") public open override /*1*/ fun toByte(): kotlin.Byte
|
||||
public open override /*1*/ fun toChar(): kotlin.Char
|
||||
@kotlin.Deprecated(message = "Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", replaceWith = kotlin.ReplaceWith(expression = "this.toInt().toChar()", imports = {})) @kotlin.DeprecatedSinceKotlin(warningSince = "1.5") public open override /*1*/ fun toChar(): kotlin.Char
|
||||
public open override /*1*/ fun toDouble(): kotlin.Double
|
||||
public open override /*1*/ fun toFloat(): kotlin.Float
|
||||
public open override /*1*/ fun toInt(): kotlin.Int
|
||||
@@ -377,7 +377,7 @@ public final class Float : kotlin.Number, kotlin.Comparable<kotlin.Float> {
|
||||
public final operator fun times(/*0*/ other: kotlin.Long): kotlin.Float
|
||||
public final operator fun times(/*0*/ other: kotlin.Short): kotlin.Float
|
||||
@kotlin.Deprecated(message = "Unclear conversion. To achieve the same result convert to Int explicitly and then to Byte.", replaceWith = kotlin.ReplaceWith(expression = "toInt().toByte()", imports = {})) @kotlin.DeprecatedSinceKotlin(errorSince = "1.5", warningSince = "1.3") public open override /*1*/ fun toByte(): kotlin.Byte
|
||||
public open override /*1*/ fun toChar(): kotlin.Char
|
||||
@kotlin.Deprecated(message = "Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", replaceWith = kotlin.ReplaceWith(expression = "this.toInt().toChar()", imports = {})) @kotlin.DeprecatedSinceKotlin(warningSince = "1.5") public open override /*1*/ fun toChar(): kotlin.Char
|
||||
public open override /*1*/ fun toDouble(): kotlin.Double
|
||||
public open override /*1*/ fun toFloat(): kotlin.Float
|
||||
public open override /*1*/ fun toInt(): kotlin.Int
|
||||
@@ -552,7 +552,7 @@ public final class Long : kotlin.Number, kotlin.Comparable<kotlin.Long> {
|
||||
public final operator fun times(/*0*/ other: kotlin.Long): kotlin.Long
|
||||
public final operator fun times(/*0*/ other: kotlin.Short): kotlin.Long
|
||||
public open override /*1*/ fun toByte(): kotlin.Byte
|
||||
public open override /*1*/ fun toChar(): kotlin.Char
|
||||
@kotlin.Deprecated(message = "Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", replaceWith = kotlin.ReplaceWith(expression = "this.toInt().toChar()", imports = {})) @kotlin.DeprecatedSinceKotlin(warningSince = "1.5") public open override /*1*/ fun toChar(): kotlin.Char
|
||||
public open override /*1*/ fun toDouble(): kotlin.Double
|
||||
public open override /*1*/ fun toFloat(): kotlin.Float
|
||||
public open override /*1*/ fun toInt(): kotlin.Int
|
||||
@@ -664,7 +664,7 @@ public final class Short : kotlin.Number, kotlin.Comparable<kotlin.Short> {
|
||||
public final operator fun times(/*0*/ other: kotlin.Long): kotlin.Long
|
||||
public final operator fun times(/*0*/ other: kotlin.Short): kotlin.Int
|
||||
public open override /*1*/ fun toByte(): kotlin.Byte
|
||||
public open override /*1*/ fun toChar(): kotlin.Char
|
||||
@kotlin.Deprecated(message = "Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", replaceWith = kotlin.ReplaceWith(expression = "this.toInt().toChar()", imports = {})) @kotlin.DeprecatedSinceKotlin(warningSince = "1.5") public open override /*1*/ fun toChar(): kotlin.Char
|
||||
public open override /*1*/ fun toDouble(): kotlin.Double
|
||||
public open override /*1*/ fun toFloat(): kotlin.Float
|
||||
public open override /*1*/ fun toInt(): kotlin.Int
|
||||
|
||||
+11
-11
@@ -102,7 +102,7 @@ public final class Byte : kotlin.Number, kotlin.Comparable<kotlin.Byte>, java.io
|
||||
public final operator fun times(/*0*/ other: kotlin.Long): kotlin.Long
|
||||
public final operator fun times(/*0*/ other: kotlin.Short): kotlin.Int
|
||||
public open override /*1*/ fun toByte(): kotlin.Byte
|
||||
public open override /*1*/ fun toChar(): kotlin.Char
|
||||
@kotlin.Deprecated(message = "Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", replaceWith = kotlin.ReplaceWith(expression = "this.toInt().toChar()", imports = {})) @kotlin.DeprecatedSinceKotlin(warningSince = "1.5") public open override /*1*/ fun toChar(): kotlin.Char
|
||||
public open override /*1*/ fun toDouble(): kotlin.Double
|
||||
public open override /*1*/ fun toFloat(): kotlin.Float
|
||||
public open override /*1*/ fun toInt(): kotlin.Int
|
||||
@@ -144,13 +144,13 @@ public final class Char : kotlin.Comparable<kotlin.Char>, java.io.Serializable {
|
||||
public final operator fun minus(/*0*/ other: kotlin.Int): kotlin.Char
|
||||
public final operator fun plus(/*0*/ other: kotlin.Int): kotlin.Char
|
||||
public final operator fun rangeTo(/*0*/ other: kotlin.Char): kotlin.ranges.CharRange
|
||||
public final fun toByte(): kotlin.Byte
|
||||
@kotlin.Deprecated(message = "Conversion of Char to Number is deprecated. Use Char.code property instead.", replaceWith = kotlin.ReplaceWith(expression = "this.code.toByte()", imports = {})) @kotlin.DeprecatedSinceKotlin(warningSince = "1.5") public final fun toByte(): kotlin.Byte
|
||||
public final fun toChar(): kotlin.Char
|
||||
public final fun toDouble(): kotlin.Double
|
||||
public final fun toFloat(): kotlin.Float
|
||||
public final fun toInt(): kotlin.Int
|
||||
public final fun toLong(): kotlin.Long
|
||||
public final fun toShort(): kotlin.Short
|
||||
@kotlin.Deprecated(message = "Conversion of Char to Number is deprecated. Use Char.code property instead.", replaceWith = kotlin.ReplaceWith(expression = "this.code.toDouble()", imports = {})) @kotlin.DeprecatedSinceKotlin(warningSince = "1.5") public final fun toDouble(): kotlin.Double
|
||||
@kotlin.Deprecated(message = "Conversion of Char to Number is deprecated. Use Char.code property instead.", replaceWith = kotlin.ReplaceWith(expression = "this.code.toFloat()", imports = {})) @kotlin.DeprecatedSinceKotlin(warningSince = "1.5") public final fun toFloat(): kotlin.Float
|
||||
@kotlin.Deprecated(message = "Conversion of Char to Number is deprecated. Use Char.code property instead.", replaceWith = kotlin.ReplaceWith(expression = "this.code", imports = {})) @kotlin.DeprecatedSinceKotlin(warningSince = "1.5") public final fun toInt(): kotlin.Int
|
||||
@kotlin.Deprecated(message = "Conversion of Char to Number is deprecated. Use Char.code property instead.", replaceWith = kotlin.ReplaceWith(expression = "this.code.toLong()", imports = {})) @kotlin.DeprecatedSinceKotlin(warningSince = "1.5") public final fun toLong(): kotlin.Long
|
||||
@kotlin.Deprecated(message = "Conversion of Char to Number is deprecated. Use Char.code property instead.", replaceWith = kotlin.ReplaceWith(expression = "this.code.toShort()", imports = {})) @kotlin.DeprecatedSinceKotlin(warningSince = "1.5") public final fun toShort(): kotlin.Short
|
||||
|
||||
public companion object Companion {
|
||||
/*primary*/ private constructor Companion()
|
||||
@@ -286,7 +286,7 @@ public final class Double : kotlin.Number, kotlin.Comparable<kotlin.Double>, jav
|
||||
public final operator fun times(/*0*/ other: kotlin.Long): kotlin.Double
|
||||
public final operator fun times(/*0*/ other: kotlin.Short): kotlin.Double
|
||||
@kotlin.Deprecated(message = "Unclear conversion. To achieve the same result convert to Int explicitly and then to Byte.", replaceWith = kotlin.ReplaceWith(expression = "toInt().toByte()", imports = {})) @kotlin.DeprecatedSinceKotlin(errorSince = "1.5", warningSince = "1.3") public open override /*1*/ fun toByte(): kotlin.Byte
|
||||
public open override /*1*/ fun toChar(): kotlin.Char
|
||||
@kotlin.Deprecated(message = "Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", replaceWith = kotlin.ReplaceWith(expression = "this.toInt().toChar()", imports = {})) @kotlin.DeprecatedSinceKotlin(warningSince = "1.5") public open override /*1*/ fun toChar(): kotlin.Char
|
||||
public open override /*1*/ fun toDouble(): kotlin.Double
|
||||
public open override /*1*/ fun toFloat(): kotlin.Float
|
||||
public open override /*1*/ fun toInt(): kotlin.Int
|
||||
@@ -390,7 +390,7 @@ public final class Float : kotlin.Number, kotlin.Comparable<kotlin.Float>, java.
|
||||
public final operator fun times(/*0*/ other: kotlin.Long): kotlin.Float
|
||||
public final operator fun times(/*0*/ other: kotlin.Short): kotlin.Float
|
||||
@kotlin.Deprecated(message = "Unclear conversion. To achieve the same result convert to Int explicitly and then to Byte.", replaceWith = kotlin.ReplaceWith(expression = "toInt().toByte()", imports = {})) @kotlin.DeprecatedSinceKotlin(errorSince = "1.5", warningSince = "1.3") public open override /*1*/ fun toByte(): kotlin.Byte
|
||||
public open override /*1*/ fun toChar(): kotlin.Char
|
||||
@kotlin.Deprecated(message = "Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", replaceWith = kotlin.ReplaceWith(expression = "this.toInt().toChar()", imports = {})) @kotlin.DeprecatedSinceKotlin(warningSince = "1.5") public open override /*1*/ fun toChar(): kotlin.Char
|
||||
public open override /*1*/ fun toDouble(): kotlin.Double
|
||||
public open override /*1*/ fun toFloat(): kotlin.Float
|
||||
public open override /*1*/ fun toInt(): kotlin.Int
|
||||
@@ -567,7 +567,7 @@ public final class Long : kotlin.Number, kotlin.Comparable<kotlin.Long>, java.io
|
||||
public final operator fun times(/*0*/ other: kotlin.Long): kotlin.Long
|
||||
public final operator fun times(/*0*/ other: kotlin.Short): kotlin.Long
|
||||
public open override /*1*/ fun toByte(): kotlin.Byte
|
||||
public open override /*1*/ fun toChar(): kotlin.Char
|
||||
@kotlin.Deprecated(message = "Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", replaceWith = kotlin.ReplaceWith(expression = "this.toInt().toChar()", imports = {})) @kotlin.DeprecatedSinceKotlin(warningSince = "1.5") public open override /*1*/ fun toChar(): kotlin.Char
|
||||
public open override /*1*/ fun toDouble(): kotlin.Double
|
||||
public open override /*1*/ fun toFloat(): kotlin.Float
|
||||
public open override /*1*/ fun toInt(): kotlin.Int
|
||||
@@ -680,7 +680,7 @@ public final class Short : kotlin.Number, kotlin.Comparable<kotlin.Short>, java.
|
||||
public final operator fun times(/*0*/ other: kotlin.Long): kotlin.Long
|
||||
public final operator fun times(/*0*/ other: kotlin.Short): kotlin.Int
|
||||
public open override /*1*/ fun toByte(): kotlin.Byte
|
||||
public open override /*1*/ fun toChar(): kotlin.Char
|
||||
@kotlin.Deprecated(message = "Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", replaceWith = kotlin.ReplaceWith(expression = "this.toInt().toChar()", imports = {})) @kotlin.DeprecatedSinceKotlin(warningSince = "1.5") public open override /*1*/ fun toChar(): kotlin.Char
|
||||
public open override /*1*/ fun toDouble(): kotlin.Double
|
||||
public open override /*1*/ fun toFloat(): kotlin.Float
|
||||
public open override /*1*/ fun toInt(): kotlin.Int
|
||||
|
||||
+11
-11
@@ -102,7 +102,7 @@ public final class Byte : kotlin.Number, kotlin.Comparable<kotlin.Byte>, java.io
|
||||
public final operator fun times(/*0*/ other: kotlin.Long): kotlin.Long
|
||||
public final operator fun times(/*0*/ other: kotlin.Short): kotlin.Int
|
||||
public open override /*1*/ fun toByte(): kotlin.Byte
|
||||
public open override /*1*/ fun toChar(): kotlin.Char
|
||||
@kotlin.Deprecated(message = "Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", replaceWith = kotlin.ReplaceWith(expression = "this.toInt().toChar()", imports = {})) @kotlin.DeprecatedSinceKotlin(warningSince = "1.5") public open override /*1*/ fun toChar(): kotlin.Char
|
||||
public open override /*1*/ fun toDouble(): kotlin.Double
|
||||
public open override /*1*/ fun toFloat(): kotlin.Float
|
||||
public open override /*1*/ fun toInt(): kotlin.Int
|
||||
@@ -144,13 +144,13 @@ public final class Char : kotlin.Comparable<kotlin.Char>, java.io.Serializable {
|
||||
public final operator fun minus(/*0*/ other: kotlin.Int): kotlin.Char
|
||||
public final operator fun plus(/*0*/ other: kotlin.Int): kotlin.Char
|
||||
public final operator fun rangeTo(/*0*/ other: kotlin.Char): kotlin.ranges.CharRange
|
||||
public final fun toByte(): kotlin.Byte
|
||||
@kotlin.Deprecated(message = "Conversion of Char to Number is deprecated. Use Char.code property instead.", replaceWith = kotlin.ReplaceWith(expression = "this.code.toByte()", imports = {})) @kotlin.DeprecatedSinceKotlin(warningSince = "1.5") public final fun toByte(): kotlin.Byte
|
||||
public final fun toChar(): kotlin.Char
|
||||
public final fun toDouble(): kotlin.Double
|
||||
public final fun toFloat(): kotlin.Float
|
||||
public final fun toInt(): kotlin.Int
|
||||
public final fun toLong(): kotlin.Long
|
||||
public final fun toShort(): kotlin.Short
|
||||
@kotlin.Deprecated(message = "Conversion of Char to Number is deprecated. Use Char.code property instead.", replaceWith = kotlin.ReplaceWith(expression = "this.code.toDouble()", imports = {})) @kotlin.DeprecatedSinceKotlin(warningSince = "1.5") public final fun toDouble(): kotlin.Double
|
||||
@kotlin.Deprecated(message = "Conversion of Char to Number is deprecated. Use Char.code property instead.", replaceWith = kotlin.ReplaceWith(expression = "this.code.toFloat()", imports = {})) @kotlin.DeprecatedSinceKotlin(warningSince = "1.5") public final fun toFloat(): kotlin.Float
|
||||
@kotlin.Deprecated(message = "Conversion of Char to Number is deprecated. Use Char.code property instead.", replaceWith = kotlin.ReplaceWith(expression = "this.code", imports = {})) @kotlin.DeprecatedSinceKotlin(warningSince = "1.5") public final fun toInt(): kotlin.Int
|
||||
@kotlin.Deprecated(message = "Conversion of Char to Number is deprecated. Use Char.code property instead.", replaceWith = kotlin.ReplaceWith(expression = "this.code.toLong()", imports = {})) @kotlin.DeprecatedSinceKotlin(warningSince = "1.5") public final fun toLong(): kotlin.Long
|
||||
@kotlin.Deprecated(message = "Conversion of Char to Number is deprecated. Use Char.code property instead.", replaceWith = kotlin.ReplaceWith(expression = "this.code.toShort()", imports = {})) @kotlin.DeprecatedSinceKotlin(warningSince = "1.5") public final fun toShort(): kotlin.Short
|
||||
|
||||
public companion object Companion {
|
||||
/*primary*/ private constructor Companion()
|
||||
@@ -288,7 +288,7 @@ public final class Double : kotlin.Number, kotlin.Comparable<kotlin.Double>, jav
|
||||
public final operator fun times(/*0*/ other: kotlin.Long): kotlin.Double
|
||||
public final operator fun times(/*0*/ other: kotlin.Short): kotlin.Double
|
||||
@kotlin.Deprecated(message = "Unclear conversion. To achieve the same result convert to Int explicitly and then to Byte.", replaceWith = kotlin.ReplaceWith(expression = "toInt().toByte()", imports = {})) @kotlin.DeprecatedSinceKotlin(errorSince = "1.5", warningSince = "1.3") public open override /*1*/ fun toByte(): kotlin.Byte
|
||||
public open override /*1*/ fun toChar(): kotlin.Char
|
||||
@kotlin.Deprecated(message = "Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", replaceWith = kotlin.ReplaceWith(expression = "this.toInt().toChar()", imports = {})) @kotlin.DeprecatedSinceKotlin(warningSince = "1.5") public open override /*1*/ fun toChar(): kotlin.Char
|
||||
public open override /*1*/ fun toDouble(): kotlin.Double
|
||||
public open override /*1*/ fun toFloat(): kotlin.Float
|
||||
public open override /*1*/ fun toInt(): kotlin.Int
|
||||
@@ -392,7 +392,7 @@ public final class Float : kotlin.Number, kotlin.Comparable<kotlin.Float>, java.
|
||||
public final operator fun times(/*0*/ other: kotlin.Long): kotlin.Float
|
||||
public final operator fun times(/*0*/ other: kotlin.Short): kotlin.Float
|
||||
@kotlin.Deprecated(message = "Unclear conversion. To achieve the same result convert to Int explicitly and then to Byte.", replaceWith = kotlin.ReplaceWith(expression = "toInt().toByte()", imports = {})) @kotlin.DeprecatedSinceKotlin(errorSince = "1.5", warningSince = "1.3") public open override /*1*/ fun toByte(): kotlin.Byte
|
||||
public open override /*1*/ fun toChar(): kotlin.Char
|
||||
@kotlin.Deprecated(message = "Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", replaceWith = kotlin.ReplaceWith(expression = "this.toInt().toChar()", imports = {})) @kotlin.DeprecatedSinceKotlin(warningSince = "1.5") public open override /*1*/ fun toChar(): kotlin.Char
|
||||
public open override /*1*/ fun toDouble(): kotlin.Double
|
||||
public open override /*1*/ fun toFloat(): kotlin.Float
|
||||
public open override /*1*/ fun toInt(): kotlin.Int
|
||||
@@ -569,7 +569,7 @@ public final class Long : kotlin.Number, kotlin.Comparable<kotlin.Long>, java.io
|
||||
public final operator fun times(/*0*/ other: kotlin.Long): kotlin.Long
|
||||
public final operator fun times(/*0*/ other: kotlin.Short): kotlin.Long
|
||||
public open override /*1*/ fun toByte(): kotlin.Byte
|
||||
public open override /*1*/ fun toChar(): kotlin.Char
|
||||
@kotlin.Deprecated(message = "Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", replaceWith = kotlin.ReplaceWith(expression = "this.toInt().toChar()", imports = {})) @kotlin.DeprecatedSinceKotlin(warningSince = "1.5") public open override /*1*/ fun toChar(): kotlin.Char
|
||||
public open override /*1*/ fun toDouble(): kotlin.Double
|
||||
public open override /*1*/ fun toFloat(): kotlin.Float
|
||||
public open override /*1*/ fun toInt(): kotlin.Int
|
||||
@@ -682,7 +682,7 @@ public final class Short : kotlin.Number, kotlin.Comparable<kotlin.Short>, java.
|
||||
public final operator fun times(/*0*/ other: kotlin.Long): kotlin.Long
|
||||
public final operator fun times(/*0*/ other: kotlin.Short): kotlin.Int
|
||||
public open override /*1*/ fun toByte(): kotlin.Byte
|
||||
public open override /*1*/ fun toChar(): kotlin.Char
|
||||
@kotlin.Deprecated(message = "Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", replaceWith = kotlin.ReplaceWith(expression = "this.toInt().toChar()", imports = {})) @kotlin.DeprecatedSinceKotlin(warningSince = "1.5") public open override /*1*/ fun toChar(): kotlin.Char
|
||||
public open override /*1*/ fun toDouble(): kotlin.Double
|
||||
public open override /*1*/ fun toFloat(): kotlin.Float
|
||||
public open override /*1*/ fun toInt(): kotlin.Int
|
||||
|
||||
+11
-11
@@ -102,7 +102,7 @@ public final class Byte : kotlin.Number, kotlin.Comparable<kotlin.Byte>, java.io
|
||||
public final operator fun times(/*0*/ other: kotlin.Long): kotlin.Long
|
||||
public final operator fun times(/*0*/ other: kotlin.Short): kotlin.Int
|
||||
public open override /*1*/ fun toByte(): kotlin.Byte
|
||||
public open override /*1*/ fun toChar(): kotlin.Char
|
||||
@kotlin.Deprecated(message = "Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", replaceWith = kotlin.ReplaceWith(expression = "this.toInt().toChar()", imports = {})) @kotlin.DeprecatedSinceKotlin(warningSince = "1.5") public open override /*1*/ fun toChar(): kotlin.Char
|
||||
public open override /*1*/ fun toDouble(): kotlin.Double
|
||||
public open override /*1*/ fun toFloat(): kotlin.Float
|
||||
public open override /*1*/ fun toInt(): kotlin.Int
|
||||
@@ -144,13 +144,13 @@ public final class Char : kotlin.Comparable<kotlin.Char>, java.io.Serializable {
|
||||
public final operator fun minus(/*0*/ other: kotlin.Int): kotlin.Char
|
||||
public final operator fun plus(/*0*/ other: kotlin.Int): kotlin.Char
|
||||
public final operator fun rangeTo(/*0*/ other: kotlin.Char): kotlin.ranges.CharRange
|
||||
public final fun toByte(): kotlin.Byte
|
||||
@kotlin.Deprecated(message = "Conversion of Char to Number is deprecated. Use Char.code property instead.", replaceWith = kotlin.ReplaceWith(expression = "this.code.toByte()", imports = {})) @kotlin.DeprecatedSinceKotlin(warningSince = "1.5") public final fun toByte(): kotlin.Byte
|
||||
public final fun toChar(): kotlin.Char
|
||||
public final fun toDouble(): kotlin.Double
|
||||
public final fun toFloat(): kotlin.Float
|
||||
public final fun toInt(): kotlin.Int
|
||||
public final fun toLong(): kotlin.Long
|
||||
public final fun toShort(): kotlin.Short
|
||||
@kotlin.Deprecated(message = "Conversion of Char to Number is deprecated. Use Char.code property instead.", replaceWith = kotlin.ReplaceWith(expression = "this.code.toDouble()", imports = {})) @kotlin.DeprecatedSinceKotlin(warningSince = "1.5") public final fun toDouble(): kotlin.Double
|
||||
@kotlin.Deprecated(message = "Conversion of Char to Number is deprecated. Use Char.code property instead.", replaceWith = kotlin.ReplaceWith(expression = "this.code.toFloat()", imports = {})) @kotlin.DeprecatedSinceKotlin(warningSince = "1.5") public final fun toFloat(): kotlin.Float
|
||||
@kotlin.Deprecated(message = "Conversion of Char to Number is deprecated. Use Char.code property instead.", replaceWith = kotlin.ReplaceWith(expression = "this.code", imports = {})) @kotlin.DeprecatedSinceKotlin(warningSince = "1.5") public final fun toInt(): kotlin.Int
|
||||
@kotlin.Deprecated(message = "Conversion of Char to Number is deprecated. Use Char.code property instead.", replaceWith = kotlin.ReplaceWith(expression = "this.code.toLong()", imports = {})) @kotlin.DeprecatedSinceKotlin(warningSince = "1.5") public final fun toLong(): kotlin.Long
|
||||
@kotlin.Deprecated(message = "Conversion of Char to Number is deprecated. Use Char.code property instead.", replaceWith = kotlin.ReplaceWith(expression = "this.code.toShort()", imports = {})) @kotlin.DeprecatedSinceKotlin(warningSince = "1.5") public final fun toShort(): kotlin.Short
|
||||
|
||||
public companion object Companion {
|
||||
/*primary*/ private constructor Companion()
|
||||
@@ -286,7 +286,7 @@ public final class Double : kotlin.Number, kotlin.Comparable<kotlin.Double>, jav
|
||||
public final operator fun times(/*0*/ other: kotlin.Long): kotlin.Double
|
||||
public final operator fun times(/*0*/ other: kotlin.Short): kotlin.Double
|
||||
@kotlin.Deprecated(message = "Unclear conversion. To achieve the same result convert to Int explicitly and then to Byte.", replaceWith = kotlin.ReplaceWith(expression = "toInt().toByte()", imports = {})) @kotlin.DeprecatedSinceKotlin(errorSince = "1.5", warningSince = "1.3") public open override /*1*/ fun toByte(): kotlin.Byte
|
||||
public open override /*1*/ fun toChar(): kotlin.Char
|
||||
@kotlin.Deprecated(message = "Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", replaceWith = kotlin.ReplaceWith(expression = "this.toInt().toChar()", imports = {})) @kotlin.DeprecatedSinceKotlin(warningSince = "1.5") public open override /*1*/ fun toChar(): kotlin.Char
|
||||
public open override /*1*/ fun toDouble(): kotlin.Double
|
||||
public open override /*1*/ fun toFloat(): kotlin.Float
|
||||
public open override /*1*/ fun toInt(): kotlin.Int
|
||||
@@ -390,7 +390,7 @@ public final class Float : kotlin.Number, kotlin.Comparable<kotlin.Float>, java.
|
||||
public final operator fun times(/*0*/ other: kotlin.Long): kotlin.Float
|
||||
public final operator fun times(/*0*/ other: kotlin.Short): kotlin.Float
|
||||
@kotlin.Deprecated(message = "Unclear conversion. To achieve the same result convert to Int explicitly and then to Byte.", replaceWith = kotlin.ReplaceWith(expression = "toInt().toByte()", imports = {})) @kotlin.DeprecatedSinceKotlin(errorSince = "1.5", warningSince = "1.3") public open override /*1*/ fun toByte(): kotlin.Byte
|
||||
public open override /*1*/ fun toChar(): kotlin.Char
|
||||
@kotlin.Deprecated(message = "Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", replaceWith = kotlin.ReplaceWith(expression = "this.toInt().toChar()", imports = {})) @kotlin.DeprecatedSinceKotlin(warningSince = "1.5") public open override /*1*/ fun toChar(): kotlin.Char
|
||||
public open override /*1*/ fun toDouble(): kotlin.Double
|
||||
public open override /*1*/ fun toFloat(): kotlin.Float
|
||||
public open override /*1*/ fun toInt(): kotlin.Int
|
||||
@@ -567,7 +567,7 @@ public final class Long : kotlin.Number, kotlin.Comparable<kotlin.Long>, java.io
|
||||
public final operator fun times(/*0*/ other: kotlin.Long): kotlin.Long
|
||||
public final operator fun times(/*0*/ other: kotlin.Short): kotlin.Long
|
||||
public open override /*1*/ fun toByte(): kotlin.Byte
|
||||
public open override /*1*/ fun toChar(): kotlin.Char
|
||||
@kotlin.Deprecated(message = "Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", replaceWith = kotlin.ReplaceWith(expression = "this.toInt().toChar()", imports = {})) @kotlin.DeprecatedSinceKotlin(warningSince = "1.5") public open override /*1*/ fun toChar(): kotlin.Char
|
||||
public open override /*1*/ fun toDouble(): kotlin.Double
|
||||
public open override /*1*/ fun toFloat(): kotlin.Float
|
||||
public open override /*1*/ fun toInt(): kotlin.Int
|
||||
@@ -680,7 +680,7 @@ public final class Short : kotlin.Number, kotlin.Comparable<kotlin.Short>, java.
|
||||
public final operator fun times(/*0*/ other: kotlin.Long): kotlin.Long
|
||||
public final operator fun times(/*0*/ other: kotlin.Short): kotlin.Int
|
||||
public open override /*1*/ fun toByte(): kotlin.Byte
|
||||
public open override /*1*/ fun toChar(): kotlin.Char
|
||||
@kotlin.Deprecated(message = "Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", replaceWith = kotlin.ReplaceWith(expression = "this.toInt().toChar()", imports = {})) @kotlin.DeprecatedSinceKotlin(warningSince = "1.5") public open override /*1*/ fun toChar(): kotlin.Char
|
||||
public open override /*1*/ fun toDouble(): kotlin.Double
|
||||
public open override /*1*/ fun toFloat(): kotlin.Float
|
||||
public open override /*1*/ fun toInt(): kotlin.Int
|
||||
|
||||
+11
-11
@@ -42,23 +42,23 @@ private val unaryOperations: HashMap<UnaryOperationKey<*>, Pair<Function1<Any?,
|
||||
unaryOperation(BYTE, "toInt", { a -> a.toInt() }, emptyUnaryFun),
|
||||
unaryOperation(BYTE, "minus", { a -> a.unaryMinus() }, { a -> a.unaryMinus() }),
|
||||
unaryOperation(BYTE, "minus", { a -> a.unaryMinus() }, { a -> a.unaryMinus() }),
|
||||
unaryOperation(BYTE, "toChar", { a -> a.toChar() }, emptyUnaryFun),
|
||||
unaryOperation(BYTE, "toChar", { a -> a.<!DEPRECATION!>toChar<!>() }, emptyUnaryFun),
|
||||
unaryOperation(BYTE, "toLong", { a -> a.toLong() }, emptyUnaryFun),
|
||||
unaryOperation(BYTE, "plus", { a -> a.unaryPlus() }, emptyUnaryFun),
|
||||
unaryOperation(BYTE, "toFloat", { a -> a.toFloat() }, emptyUnaryFun),
|
||||
unaryOperation(BYTE, "toDouble", { a -> a.toDouble() }, emptyUnaryFun),
|
||||
unaryOperation(BYTE, "toShort", { a -> a.toShort() }, emptyUnaryFun),
|
||||
unaryOperation(BYTE, "toByte", { a -> a.toByte() }, emptyUnaryFun),
|
||||
unaryOperation(CHAR, "toInt", { a -> a.toInt() }, emptyUnaryFun),
|
||||
unaryOperation(CHAR, "toInt", { a -> a.<!DEPRECATION!>toInt<!>() }, emptyUnaryFun),
|
||||
unaryOperation(CHAR, "toChar", { a -> a.toChar() }, emptyUnaryFun),
|
||||
unaryOperation(CHAR, "toLong", { a -> a.toLong() }, emptyUnaryFun),
|
||||
unaryOperation(CHAR, "toFloat", { a -> a.toFloat() }, emptyUnaryFun),
|
||||
unaryOperation(CHAR, "toDouble", { a -> a.toDouble() }, emptyUnaryFun),
|
||||
unaryOperation(CHAR, "toShort", { a -> a.toShort() }, emptyUnaryFun),
|
||||
unaryOperation(CHAR, "toByte", { a -> a.toByte() }, emptyUnaryFun),
|
||||
unaryOperation(CHAR, "toLong", { a -> a.<!DEPRECATION!>toLong<!>() }, emptyUnaryFun),
|
||||
unaryOperation(CHAR, "toFloat", { a -> a.<!DEPRECATION!>toFloat<!>() }, emptyUnaryFun),
|
||||
unaryOperation(CHAR, "toDouble", { a -> a.<!DEPRECATION!>toDouble<!>() }, emptyUnaryFun),
|
||||
unaryOperation(CHAR, "toShort", { a -> a.<!DEPRECATION!>toShort<!>() }, emptyUnaryFun),
|
||||
unaryOperation(CHAR, "toByte", { a -> a.<!DEPRECATION!>toByte<!>() }, emptyUnaryFun),
|
||||
unaryOperation(DOUBLE, "toInt", { a -> a.toInt() }, emptyUnaryFun),
|
||||
unaryOperation(DOUBLE, "minus", { a -> a.unaryMinus() }, emptyUnaryFun),
|
||||
unaryOperation(DOUBLE, "toChar", { a -> a.toChar() }, emptyUnaryFun),
|
||||
unaryOperation(DOUBLE, "toChar", { a -> a.<!DEPRECATION!>toChar<!>() }, emptyUnaryFun),
|
||||
unaryOperation(DOUBLE, "toLong", { a -> a.toLong() }, emptyUnaryFun),
|
||||
unaryOperation(DOUBLE, "plus", { a -> a.unaryPlus() }, emptyUnaryFun),
|
||||
unaryOperation(DOUBLE, "toFloat", { a -> a.toFloat() }, emptyUnaryFun),
|
||||
@@ -67,7 +67,7 @@ private val unaryOperations: HashMap<UnaryOperationKey<*>, Pair<Function1<Any?,
|
||||
unaryOperation(DOUBLE, "toByte", { a -> a.<!DEPRECATION_ERROR!>toByte<!>() }, emptyUnaryFun),
|
||||
unaryOperation(FLOAT, "toInt", { a -> a.toInt() }, emptyUnaryFun),
|
||||
unaryOperation(FLOAT, "minus", { a -> a.unaryMinus() }, emptyUnaryFun),
|
||||
unaryOperation(FLOAT, "toChar", { a -> a.toChar() }, emptyUnaryFun),
|
||||
unaryOperation(FLOAT, "toChar", { a -> a.<!DEPRECATION!>toChar<!>() }, emptyUnaryFun),
|
||||
unaryOperation(FLOAT, "toLong", { a -> a.toLong() }, emptyUnaryFun),
|
||||
unaryOperation(FLOAT, "plus", { a -> a.unaryPlus() }, emptyUnaryFun),
|
||||
unaryOperation(FLOAT, "toFloat", { a -> a.toFloat() }, emptyUnaryFun),
|
||||
@@ -90,13 +90,13 @@ private val unaryOperations: HashMap<UnaryOperationKey<*>, Pair<Function1<Any?,
|
||||
unaryOperation(LONG, "inv", { a -> a.inv() }, emptyUnaryFun),
|
||||
unaryOperation(LONG, "toInt", { a -> a.toInt() }, emptyUnaryFun),
|
||||
unaryOperation(LONG, "minus", { a -> a.unaryMinus() }, { a -> a.unaryMinus() }),
|
||||
unaryOperation(LONG, "toChar", { a -> a.toChar() }, emptyUnaryFun),
|
||||
unaryOperation(LONG, "toChar", { a -> a.<!DEPRECATION!>toChar<!>() }, emptyUnaryFun),
|
||||
unaryOperation(LONG, "toLong", { a -> a.toLong() }, emptyUnaryFun),
|
||||
unaryOperation(LONG, "toDouble", { a -> a.toDouble() }, emptyUnaryFun),
|
||||
unaryOperation(LONG, "toFloat", { a -> a.toFloat() }, emptyUnaryFun),
|
||||
unaryOperation(SHORT, "toInt", { a -> a.toInt() }, emptyUnaryFun),
|
||||
unaryOperation(SHORT, "minus", { a -> a.unaryMinus() }, { a -> a.unaryMinus() }),
|
||||
unaryOperation(SHORT, "toChar", { a -> a.toChar() }, emptyUnaryFun),
|
||||
unaryOperation(SHORT, "toChar", { a -> a.<!DEPRECATION!>toChar<!>() }, emptyUnaryFun),
|
||||
unaryOperation(SHORT, "toLong", { a -> a.toLong() }, emptyUnaryFun),
|
||||
unaryOperation(SHORT, "plus", { a -> a.unaryPlus() }, emptyUnaryFun),
|
||||
unaryOperation(SHORT, "toFloat", { a -> a.toFloat() }, emptyUnaryFun),
|
||||
|
||||
@@ -47,18 +47,30 @@ public class Char private constructor() : Comparable<Char> {
|
||||
public operator fun rangeTo(other: Char): CharRange
|
||||
|
||||
/** Returns the value of this character as a `Byte`. */
|
||||
@Deprecated("Conversion of Char to Number is deprecated. Use Char.code property instead.", ReplaceWith("this.code.toByte()"))
|
||||
@DeprecatedSinceKotlin(warningSince = "1.5")
|
||||
public fun toByte(): Byte
|
||||
/** Returns the value of this character as a `Char`. */
|
||||
public fun toChar(): Char
|
||||
/** Returns the value of this character as a `Short`. */
|
||||
@Deprecated("Conversion of Char to Number is deprecated. Use Char.code property instead.", ReplaceWith("this.code.toShort()"))
|
||||
@DeprecatedSinceKotlin(warningSince = "1.5")
|
||||
public fun toShort(): Short
|
||||
/** Returns the value of this character as a `Int`. */
|
||||
@Deprecated("Conversion of Char to Number is deprecated. Use Char.code property instead.", ReplaceWith("this.code"))
|
||||
@DeprecatedSinceKotlin(warningSince = "1.5")
|
||||
public fun toInt(): Int
|
||||
/** Returns the value of this character as a `Long`. */
|
||||
@Deprecated("Conversion of Char to Number is deprecated. Use Char.code property instead.", ReplaceWith("this.code.toLong()"))
|
||||
@DeprecatedSinceKotlin(warningSince = "1.5")
|
||||
public fun toLong(): Long
|
||||
/** Returns the value of this character as a `Float`. */
|
||||
@Deprecated("Conversion of Char to Number is deprecated. Use Char.code property instead.", ReplaceWith("this.code.toFloat()"))
|
||||
@DeprecatedSinceKotlin(warningSince = "1.5")
|
||||
public fun toFloat(): Float
|
||||
/** Returns the value of this character as a `Double`. */
|
||||
@Deprecated("Conversion of Char to Number is deprecated. Use Char.code property instead.", ReplaceWith("this.code.toDouble()"))
|
||||
@DeprecatedSinceKotlin(warningSince = "1.5")
|
||||
public fun toDouble(): Double
|
||||
|
||||
companion object {
|
||||
|
||||
@@ -43,6 +43,7 @@ public abstract class Number {
|
||||
/**
|
||||
* Returns the [Char] with the numeric value equal to this number, truncated to 16 bits if appropriate.
|
||||
*/
|
||||
// @Deprecated("Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", ReplaceWith("this.toInt().toChar()"))
|
||||
public abstract fun toChar(): Char
|
||||
|
||||
/**
|
||||
|
||||
@@ -201,6 +201,8 @@ public class Byte private constructor() : Number(), Comparable<Byte> {
|
||||
* The least significant 8 bits of the resulting `Char` code are the same as the bits of this `Byte` value,
|
||||
* whereas the most significant 8 bits are filled with the sign bit of this value.
|
||||
*/
|
||||
@Deprecated("Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", ReplaceWith("this.toInt().toChar()"))
|
||||
@DeprecatedSinceKotlin(warningSince = "1.5")
|
||||
public override fun toChar(): Char
|
||||
/**
|
||||
* Converts this [Byte] value to [Short].
|
||||
@@ -442,6 +444,8 @@ public class Short private constructor() : Number(), Comparable<Short> {
|
||||
* The resulting `Char` code is equal to this value reinterpreted as an unsigned number,
|
||||
* i.e. it has the same binary representation as this `Short`.
|
||||
*/
|
||||
@Deprecated("Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", ReplaceWith("this.toInt().toChar()"))
|
||||
@DeprecatedSinceKotlin(warningSince = "1.5")
|
||||
public override fun toChar(): Char
|
||||
/** Returns this value. */
|
||||
public override fun toShort(): Short
|
||||
@@ -982,6 +986,8 @@ public class Long private constructor() : Number(), Comparable<Long> {
|
||||
*
|
||||
* The resulting `Char` code is represented by the least significant 16 bits of this `Long` value.
|
||||
*/
|
||||
@Deprecated("Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", ReplaceWith("this.toInt().toChar()"))
|
||||
@DeprecatedSinceKotlin(warningSince = "1.5")
|
||||
public override fun toChar(): Char
|
||||
/**
|
||||
* Converts this [Long] value to [Short].
|
||||
@@ -1225,6 +1231,8 @@ public class Float private constructor() : Number(), Comparable<Float> {
|
||||
*
|
||||
* The resulting `Char` value is equal to `this.toInt().toChar()`.
|
||||
*/
|
||||
@Deprecated("Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", ReplaceWith("this.toInt().toChar()"))
|
||||
@DeprecatedSinceKotlin(warningSince = "1.5")
|
||||
public override fun toChar(): Char
|
||||
/**
|
||||
* Converts this [Float] value to [Short].
|
||||
@@ -1464,6 +1472,8 @@ public class Double private constructor() : Number(), Comparable<Double> {
|
||||
*
|
||||
* The resulting `Char` value is equal to `this.toInt().toChar()`.
|
||||
*/
|
||||
@Deprecated("Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", ReplaceWith("this.toInt().toChar()"))
|
||||
@DeprecatedSinceKotlin(warningSince = "1.5")
|
||||
public override fun toChar(): Char
|
||||
/**
|
||||
* Converts this [Double] value to [Short].
|
||||
|
||||
@@ -12,9 +12,9 @@ package kotlin.ranges
|
||||
* @property step the number by which the value is incremented on each step.
|
||||
*/
|
||||
internal class CharProgressionIterator(first: Char, last: Char, val step: Int) : CharIterator() {
|
||||
private val finalElement = last.toInt()
|
||||
private val finalElement: Int = last.code
|
||||
private var hasNext: Boolean = if (step > 0) first <= last else first >= last
|
||||
private var next = if (hasNext) first.toInt() else finalElement
|
||||
private var next: Int = if (hasNext) first.code else finalElement
|
||||
|
||||
override fun hasNext(): Boolean = hasNext
|
||||
|
||||
@@ -36,9 +36,9 @@ internal class CharProgressionIterator(first: Char, last: Char, val step: Int) :
|
||||
* @property step the number by which the value is incremented on each step.
|
||||
*/
|
||||
internal class IntProgressionIterator(first: Int, last: Int, val step: Int) : IntIterator() {
|
||||
private val finalElement = last
|
||||
private val finalElement: Int = last
|
||||
private var hasNext: Boolean = if (step > 0) first <= last else first >= last
|
||||
private var next = if (hasNext) first else finalElement
|
||||
private var next: Int = if (hasNext) first else finalElement
|
||||
|
||||
override fun hasNext(): Boolean = hasNext
|
||||
|
||||
@@ -60,9 +60,9 @@ internal class IntProgressionIterator(first: Int, last: Int, val step: Int) : In
|
||||
* @property step the number by which the value is incremented on each step.
|
||||
*/
|
||||
internal class LongProgressionIterator(first: Long, last: Long, val step: Long) : LongIterator() {
|
||||
private val finalElement = last
|
||||
private val finalElement: Long = last
|
||||
private var hasNext: Boolean = if (step > 0) first <= last else first >= last
|
||||
private var next = if (hasNext) first else finalElement
|
||||
private var next: Long = if (hasNext) first else finalElement
|
||||
|
||||
override fun hasNext(): Boolean = hasNext
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ public open class CharProgression
|
||||
/**
|
||||
* The last element in the progression.
|
||||
*/
|
||||
public val last: Char = getProgressionLastElement(start.toInt(), endInclusive.toInt(), step).toChar()
|
||||
public val last: Char = getProgressionLastElement(start.code, endInclusive.code, step).toChar()
|
||||
|
||||
/**
|
||||
* The step of the progression.
|
||||
@@ -54,7 +54,7 @@ public open class CharProgression
|
||||
first == other.first && last == other.last && step == other.step)
|
||||
|
||||
override fun hashCode(): Int =
|
||||
if (isEmpty()) -1 else (31 * (31 * first.toInt() + last.toInt()) + step)
|
||||
if (isEmpty()) -1 else (31 * (31 * first.code + last.code) + step)
|
||||
|
||||
override fun toString(): String = if (step > 0) "$first..$last step $step" else "$first downTo $last step ${-step}"
|
||||
|
||||
@@ -94,7 +94,7 @@ public open class IntProgression
|
||||
/**
|
||||
* The last element in the progression.
|
||||
*/
|
||||
public val last: Int = getProgressionLastElement(start.toInt(), endInclusive.toInt(), step).toInt()
|
||||
public val last: Int = getProgressionLastElement(start, endInclusive, step)
|
||||
|
||||
/**
|
||||
* The step of the progression.
|
||||
@@ -156,7 +156,7 @@ public open class LongProgression
|
||||
/**
|
||||
* The last element in the progression.
|
||||
*/
|
||||
public val last: Long = getProgressionLastElement(start.toLong(), endInclusive.toLong(), step).toLong()
|
||||
public val last: Long = getProgressionLastElement(start, endInclusive, step)
|
||||
|
||||
/**
|
||||
* The step of the progression.
|
||||
|
||||
@@ -28,7 +28,7 @@ public class CharRange(start: Char, endInclusive: Char) : CharProgression(start,
|
||||
first == other.first && last == other.last)
|
||||
|
||||
override fun hashCode(): Int =
|
||||
if (isEmpty()) -1 else (31 * first.toInt() + last.toInt())
|
||||
if (isEmpty()) -1 else (31 * first.code + last.code)
|
||||
|
||||
override fun toString(): String = "$first..$last"
|
||||
|
||||
|
||||
@@ -394,10 +394,14 @@ class GeneratePrimitives(out: PrintWriter) : BuiltInsSourceGenerator(out) {
|
||||
}
|
||||
|
||||
private fun generateConversions(kind: PrimitiveType) {
|
||||
fun isConversionDeprecated(otherKind: PrimitiveType): Boolean {
|
||||
fun isFpToIntConversionDeprecated(otherKind: PrimitiveType): Boolean {
|
||||
return kind in PrimitiveType.floatingPoint && otherKind in listOf(PrimitiveType.BYTE, PrimitiveType.SHORT)
|
||||
}
|
||||
|
||||
fun isCharConversionDeprecated(otherKind: PrimitiveType): Boolean {
|
||||
return kind != PrimitiveType.INT && otherKind == PrimitiveType.CHAR
|
||||
}
|
||||
|
||||
val thisName = kind.capitalized
|
||||
for (otherKind in PrimitiveType.exceptBoolean) {
|
||||
val otherName = otherKind.capitalized
|
||||
@@ -422,10 +426,14 @@ class GeneratePrimitives(out: PrintWriter) : BuiltInsSourceGenerator(out) {
|
||||
}
|
||||
out.println(doc)
|
||||
|
||||
if (isConversionDeprecated(otherKind)) {
|
||||
if (isFpToIntConversionDeprecated(otherKind)) {
|
||||
out.println(" @Deprecated(\"Unclear conversion. To achieve the same result convert to Int explicitly and then to $otherName.\", ReplaceWith(\"toInt().to$otherName()\"))")
|
||||
out.println(" @DeprecatedSinceKotlin(warningSince = \"1.3\", errorSince = \"1.5\")")
|
||||
}
|
||||
if (isCharConversionDeprecated(otherKind)) {
|
||||
out.println(" @Deprecated(\"Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.\", ReplaceWith(\"this.toInt().toChar()\"))")
|
||||
out.println(" @DeprecatedSinceKotlin(warningSince = \"1.5\")")
|
||||
}
|
||||
|
||||
out.println(" public override fun to$otherName(): $otherName")
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ fun integerProgressionIterator(kind: ProgressionKind): String {
|
||||
val incrementType = progressionIncrementType(kind)
|
||||
|
||||
val (toInt, toType) = when (kind) {
|
||||
CHAR -> ".toInt()" to ".to$t()"
|
||||
CHAR -> ".code" to ".toChar()"
|
||||
else -> "" to ""
|
||||
}
|
||||
|
||||
@@ -36,9 +36,9 @@ fun integerProgressionIterator(kind: ProgressionKind): String {
|
||||
* @property step the number by which the value is incremented on each step.
|
||||
*/
|
||||
internal class ${t}ProgressionIterator(first: $t, last: $t, val step: $incrementType) : ${t}Iterator() {
|
||||
private val finalElement = last$toInt
|
||||
private val finalElement: $incrementType = last$toInt
|
||||
private var hasNext: Boolean = if (step > 0) first <= last else first >= last
|
||||
private var next = if (hasNext) first$toInt else finalElement
|
||||
private var next: $incrementType = if (hasNext) first$toInt else finalElement
|
||||
|
||||
override fun hasNext(): Boolean = hasNext
|
||||
|
||||
|
||||
@@ -42,12 +42,20 @@ class GenerateProgressions(out: PrintWriter) : BuiltInsSourceGenerator(out) {
|
||||
|
||||
val hashCode = "=\n" + when (kind) {
|
||||
CHAR ->
|
||||
" if (isEmpty()) -1 else (31 * (31 * first.toInt() + last.toInt()) + step)"
|
||||
" if (isEmpty()) -1 else (31 * (31 * first.code + last.code) + step)"
|
||||
INT ->
|
||||
" if (isEmpty()) -1 else (31 * (31 * first + last) + step)"
|
||||
LONG ->
|
||||
" if (isEmpty()) -1 else (31 * (31 * ${hashLong("first")} + ${hashLong("last")}) + ${hashLong("step")}).toInt()"
|
||||
}
|
||||
val elementToIncrement = when (kind) {
|
||||
CHAR -> ".code"
|
||||
else -> ""
|
||||
}
|
||||
val incrementToElement = when (kind) {
|
||||
CHAR -> ".toChar()"
|
||||
else -> ""
|
||||
}
|
||||
|
||||
out.println(
|
||||
"""/**
|
||||
@@ -73,7 +81,7 @@ public open class $progression
|
||||
/**
|
||||
* The last element in the progression.
|
||||
*/
|
||||
public val last: $t = getProgressionLastElement(start.to$incrementType(), endInclusive.to$incrementType(), step).to$t()
|
||||
public val last: $t = getProgressionLastElement(start$elementToIncrement, endInclusive$elementToIncrement, step)$incrementToElement
|
||||
|
||||
/**
|
||||
* The step of the progression.
|
||||
|
||||
@@ -39,7 +39,7 @@ class GenerateRanges(out: PrintWriter) : BuiltInsSourceGenerator(out) {
|
||||
|
||||
val hashCode = when (kind) {
|
||||
CHAR -> "=\n" +
|
||||
" if (isEmpty()) -1 else (31 * first.toInt() + last.toInt())"
|
||||
" if (isEmpty()) -1 else (31 * first.code + last.code)"
|
||||
INT -> "=\n" +
|
||||
" if (isEmpty()) -1 else (31 * first + last)"
|
||||
LONG -> "=\n" +
|
||||
|
||||
@@ -1021,6 +1021,8 @@ public final class Byte : kotlin.Number, kotlin.Comparable<kotlin.Byte> {
|
||||
|
||||
public open override fun toByte(): kotlin.Byte
|
||||
|
||||
@kotlin.Deprecated(message = "Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", replaceWith = kotlin.ReplaceWith(expression = "this.toInt().toChar()", imports = {}))
|
||||
@kotlin.DeprecatedSinceKotlin(warningSince = "1.5")
|
||||
public open override fun toChar(): kotlin.Char
|
||||
|
||||
public open override fun toDouble(): kotlin.Double
|
||||
@@ -1079,18 +1081,30 @@ public final class Char : kotlin.Comparable<kotlin.Char> {
|
||||
|
||||
public final operator fun rangeTo(other: kotlin.Char): kotlin.ranges.CharRange
|
||||
|
||||
@kotlin.Deprecated(message = "Conversion of Char to Number is deprecated. Use Char.code property instead.", replaceWith = kotlin.ReplaceWith(expression = "this.code.toByte()", imports = {}))
|
||||
@kotlin.DeprecatedSinceKotlin(warningSince = "1.5")
|
||||
public final fun toByte(): kotlin.Byte
|
||||
|
||||
public final fun toChar(): kotlin.Char
|
||||
|
||||
@kotlin.Deprecated(message = "Conversion of Char to Number is deprecated. Use Char.code property instead.", replaceWith = kotlin.ReplaceWith(expression = "this.code.toDouble()", imports = {}))
|
||||
@kotlin.DeprecatedSinceKotlin(warningSince = "1.5")
|
||||
public final fun toDouble(): kotlin.Double
|
||||
|
||||
@kotlin.Deprecated(message = "Conversion of Char to Number is deprecated. Use Char.code property instead.", replaceWith = kotlin.ReplaceWith(expression = "this.code.toFloat()", imports = {}))
|
||||
@kotlin.DeprecatedSinceKotlin(warningSince = "1.5")
|
||||
public final fun toFloat(): kotlin.Float
|
||||
|
||||
@kotlin.Deprecated(message = "Conversion of Char to Number is deprecated. Use Char.code property instead.", replaceWith = kotlin.ReplaceWith(expression = "this.code", imports = {}))
|
||||
@kotlin.DeprecatedSinceKotlin(warningSince = "1.5")
|
||||
public final fun toInt(): kotlin.Int
|
||||
|
||||
@kotlin.Deprecated(message = "Conversion of Char to Number is deprecated. Use Char.code property instead.", replaceWith = kotlin.ReplaceWith(expression = "this.code.toLong()", imports = {}))
|
||||
@kotlin.DeprecatedSinceKotlin(warningSince = "1.5")
|
||||
public final fun toLong(): kotlin.Long
|
||||
|
||||
@kotlin.Deprecated(message = "Conversion of Char to Number is deprecated. Use Char.code property instead.", replaceWith = kotlin.ReplaceWith(expression = "this.code.toShort()", imports = {}))
|
||||
@kotlin.DeprecatedSinceKotlin(warningSince = "1.5")
|
||||
public final fun toShort(): kotlin.Short
|
||||
|
||||
public companion object of Char {
|
||||
@@ -1315,6 +1329,8 @@ public final class Double : kotlin.Number, kotlin.Comparable<kotlin.Double> {
|
||||
@kotlin.DeprecatedSinceKotlin(errorSince = "1.5", warningSince = "1.3")
|
||||
public open override fun toByte(): kotlin.Byte
|
||||
|
||||
@kotlin.Deprecated(message = "Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", replaceWith = kotlin.ReplaceWith(expression = "this.toInt().toChar()", imports = {}))
|
||||
@kotlin.DeprecatedSinceKotlin(warningSince = "1.5")
|
||||
public open override fun toChar(): kotlin.Char
|
||||
|
||||
public open override fun toDouble(): kotlin.Double
|
||||
@@ -1552,6 +1568,8 @@ public final class Float : kotlin.Number, kotlin.Comparable<kotlin.Float> {
|
||||
@kotlin.DeprecatedSinceKotlin(errorSince = "1.5", warningSince = "1.3")
|
||||
public open override fun toByte(): kotlin.Byte
|
||||
|
||||
@kotlin.Deprecated(message = "Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", replaceWith = kotlin.ReplaceWith(expression = "this.toInt().toChar()", imports = {}))
|
||||
@kotlin.DeprecatedSinceKotlin(warningSince = "1.5")
|
||||
public open override fun toChar(): kotlin.Char
|
||||
|
||||
public open override fun toDouble(): kotlin.Double
|
||||
@@ -1933,6 +1951,8 @@ public final class Long : kotlin.Number, kotlin.Comparable<kotlin.Long> {
|
||||
|
||||
public open override fun toByte(): kotlin.Byte
|
||||
|
||||
@kotlin.Deprecated(message = "Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", replaceWith = kotlin.ReplaceWith(expression = "this.toInt().toChar()", imports = {}))
|
||||
@kotlin.DeprecatedSinceKotlin(warningSince = "1.5")
|
||||
public open override fun toChar(): kotlin.Char
|
||||
|
||||
public open override fun toDouble(): kotlin.Double
|
||||
@@ -2254,6 +2274,8 @@ public final class Short : kotlin.Number, kotlin.Comparable<kotlin.Short> {
|
||||
|
||||
public open override fun toByte(): kotlin.Byte
|
||||
|
||||
@kotlin.Deprecated(message = "Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", replaceWith = kotlin.ReplaceWith(expression = "this.toInt().toChar()", imports = {}))
|
||||
/*∆*/ @kotlin.DeprecatedSinceKotlin(warningSince = "1.5")
|
||||
public open override fun toChar(): kotlin.Char
|
||||
|
||||
public open override fun toDouble(): kotlin.Double
|
||||
|
||||
@@ -987,6 +987,8 @@ public final class Byte : kotlin.Number, kotlin.Comparable<kotlin.Byte> {
|
||||
|
||||
public open override fun toByte(): kotlin.Byte
|
||||
|
||||
@kotlin.Deprecated(message = "Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", replaceWith = kotlin.ReplaceWith(expression = "this.toInt().toChar()", imports = {}))
|
||||
@kotlin.DeprecatedSinceKotlin(warningSince = "1.5")
|
||||
public open override fun toChar(): kotlin.Char
|
||||
|
||||
public open override fun toDouble(): kotlin.Double
|
||||
@@ -1055,18 +1057,30 @@ public final class Char : kotlin.Comparable<kotlin.Char> {
|
||||
|
||||
public final operator fun rangeTo(other: kotlin.Char): kotlin.ranges.CharRange
|
||||
|
||||
@kotlin.Deprecated(message = "Conversion of Char to Number is deprecated. Use Char.code property instead.", replaceWith = kotlin.ReplaceWith(expression = "this.code.toByte()", imports = {}))
|
||||
@kotlin.DeprecatedSinceKotlin(warningSince = "1.5")
|
||||
public final fun toByte(): kotlin.Byte
|
||||
|
||||
public final fun toChar(): kotlin.Char
|
||||
|
||||
@kotlin.Deprecated(message = "Conversion of Char to Number is deprecated. Use Char.code property instead.", replaceWith = kotlin.ReplaceWith(expression = "this.code.toDouble()", imports = {}))
|
||||
@kotlin.DeprecatedSinceKotlin(warningSince = "1.5")
|
||||
public final fun toDouble(): kotlin.Double
|
||||
|
||||
@kotlin.Deprecated(message = "Conversion of Char to Number is deprecated. Use Char.code property instead.", replaceWith = kotlin.ReplaceWith(expression = "this.code.toFloat()", imports = {}))
|
||||
@kotlin.DeprecatedSinceKotlin(warningSince = "1.5")
|
||||
public final fun toFloat(): kotlin.Float
|
||||
|
||||
@kotlin.Deprecated(message = "Conversion of Char to Number is deprecated. Use Char.code property instead.", replaceWith = kotlin.ReplaceWith(expression = "this.code", imports = {}))
|
||||
@kotlin.DeprecatedSinceKotlin(warningSince = "1.5")
|
||||
public final fun toInt(): kotlin.Int
|
||||
|
||||
@kotlin.Deprecated(message = "Conversion of Char to Number is deprecated. Use Char.code property instead.", replaceWith = kotlin.ReplaceWith(expression = "this.code.toLong()", imports = {}))
|
||||
@kotlin.DeprecatedSinceKotlin(warningSince = "1.5")
|
||||
public final fun toLong(): kotlin.Long
|
||||
|
||||
@kotlin.Deprecated(message = "Conversion of Char to Number is deprecated. Use Char.code property instead.", replaceWith = kotlin.ReplaceWith(expression = "this.code.toShort()", imports = {}))
|
||||
@kotlin.DeprecatedSinceKotlin(warningSince = "1.5")
|
||||
public final fun toShort(): kotlin.Short
|
||||
|
||||
/*∆*/ @kotlin.js.JsName(name = "toString")
|
||||
@@ -1290,6 +1304,8 @@ public final class Double : kotlin.Number, kotlin.Comparable<kotlin.Double> {
|
||||
@kotlin.DeprecatedSinceKotlin(errorSince = "1.5", warningSince = "1.3")
|
||||
public open override fun toByte(): kotlin.Byte
|
||||
|
||||
@kotlin.Deprecated(message = "Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", replaceWith = kotlin.ReplaceWith(expression = "this.toInt().toChar()", imports = {}))
|
||||
@kotlin.DeprecatedSinceKotlin(warningSince = "1.5")
|
||||
public open override fun toChar(): kotlin.Char
|
||||
|
||||
public open override fun toDouble(): kotlin.Double
|
||||
@@ -1531,6 +1547,8 @@ public final class Float : kotlin.Number, kotlin.Comparable<kotlin.Float> {
|
||||
@kotlin.DeprecatedSinceKotlin(errorSince = "1.5", warningSince = "1.3")
|
||||
public open override fun toByte(): kotlin.Byte
|
||||
|
||||
@kotlin.Deprecated(message = "Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", replaceWith = kotlin.ReplaceWith(expression = "this.toInt().toChar()", imports = {}))
|
||||
@kotlin.DeprecatedSinceKotlin(warningSince = "1.5")
|
||||
public open override fun toChar(): kotlin.Char
|
||||
|
||||
public open override fun toDouble(): kotlin.Double
|
||||
@@ -1921,6 +1939,8 @@ public final class Long : kotlin.Number, kotlin.Comparable<kotlin.Long> {
|
||||
|
||||
public open override fun toByte(): kotlin.Byte
|
||||
|
||||
@kotlin.Deprecated(message = "Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", replaceWith = kotlin.ReplaceWith(expression = "this.toInt().toChar()", imports = {}))
|
||||
@kotlin.DeprecatedSinceKotlin(warningSince = "1.5")
|
||||
public open override fun toChar(): kotlin.Char
|
||||
|
||||
public open override fun toDouble(): kotlin.Double
|
||||
@@ -2248,6 +2268,7 @@ public final class Short : kotlin.Number, kotlin.Comparable<kotlin.Short> {
|
||||
|
||||
public open override fun toByte(): kotlin.Byte
|
||||
|
||||
@kotlin.Deprecated(message = "Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", replaceWith = kotlin.ReplaceWith(expression = "this.toInt().toChar()", imports = {}))
|
||||
public open override fun toChar(): kotlin.Char
|
||||
|
||||
public open override fun toDouble(): kotlin.Double
|
||||
|
||||
@@ -84,7 +84,7 @@ public fun LongRange.random(random: Random): Long {
|
||||
@SinceKotlin("1.3")
|
||||
public fun CharRange.random(random: Random): Char {
|
||||
try {
|
||||
return random.nextInt(first.toInt(), last.toInt() + 1).toChar()
|
||||
return random.nextInt(first.code, last.code + 1).toChar()
|
||||
} catch(e: IllegalArgumentException) {
|
||||
throw NoSuchElementException(e.message)
|
||||
}
|
||||
@@ -150,7 +150,7 @@ public fun LongRange.randomOrNull(random: Random): Long? {
|
||||
public fun CharRange.randomOrNull(random: Random): Char? {
|
||||
if (isEmpty())
|
||||
return null
|
||||
return random.nextInt(first.toInt(), last.toInt() + 1).toChar()
|
||||
return random.nextInt(first.code, last.code + 1).toChar()
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -41,18 +41,30 @@ constructor(code: UShort) : Comparable<Char> {
|
||||
public operator fun rangeTo(other: Char): CharRange = CharRange(this, other)
|
||||
|
||||
/** Returns the value of this character as a `Byte`. */
|
||||
@Deprecated("Conversion of Char to Number is deprecated. Use Char.code property instead.", ReplaceWith("this.code.toByte()"))
|
||||
@DeprecatedSinceKotlin(warningSince = "1.5")
|
||||
public fun toByte(): Byte = value.toByte()
|
||||
/** Returns the value of this character as a `Char`. */
|
||||
public fun toChar(): Char = this
|
||||
/** Returns the value of this character as a `Short`. */
|
||||
@Deprecated("Conversion of Char to Number is deprecated. Use Char.code property instead.", ReplaceWith("this.code.toShort()"))
|
||||
@DeprecatedSinceKotlin(warningSince = "1.5")
|
||||
public fun toShort(): Short = value.toShort()
|
||||
/** Returns the value of this character as a `Int`. */
|
||||
@Deprecated("Conversion of Char to Number is deprecated. Use Char.code property instead.", ReplaceWith("this.code"))
|
||||
@DeprecatedSinceKotlin(warningSince = "1.5")
|
||||
public fun toInt(): Int = value
|
||||
/** Returns the value of this character as a `Long`. */
|
||||
@Deprecated("Conversion of Char to Number is deprecated. Use Char.code property instead.", ReplaceWith("this.code.toLong()"))
|
||||
@DeprecatedSinceKotlin(warningSince = "1.5")
|
||||
public fun toLong(): Long = value.toLong()
|
||||
/** Returns the value of this character as a `Float`. */
|
||||
@Deprecated("Conversion of Char to Number is deprecated. Use Char.code property instead.", ReplaceWith("this.code.toFloat()"))
|
||||
@DeprecatedSinceKotlin(warningSince = "1.5")
|
||||
public fun toFloat(): Float = value.toFloat()
|
||||
/** Returns the value of this character as a `Double`. */
|
||||
@Deprecated("Conversion of Char to Number is deprecated. Use Char.code property instead.", ReplaceWith("this.code.toDouble()"))
|
||||
@DeprecatedSinceKotlin(warningSince = "1.5")
|
||||
public fun toDouble(): Double = value.toDouble()
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
|
||||
@@ -202,6 +202,8 @@ public class Byte private constructor() : Number(), Comparable<Byte> {
|
||||
* The least significant 8 bits of the resulting `Char` code are the same as the bits of this `Byte` value,
|
||||
* whereas the most significant 8 bits are filled with the sign bit of this value.
|
||||
*/
|
||||
@Deprecated("Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", ReplaceWith("this.toInt().toChar()"))
|
||||
@DeprecatedSinceKotlin(warningSince = "1.5")
|
||||
public override fun toChar(): Char
|
||||
/**
|
||||
* Converts this [Byte] value to [Short].
|
||||
@@ -447,6 +449,7 @@ public class Short private constructor() : Number(), Comparable<Short> {
|
||||
* The resulting `Char` code is equal to this value reinterpreted as an unsigned number,
|
||||
* i.e. it has the same binary representation as this `Short`.
|
||||
*/
|
||||
@Deprecated("Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", ReplaceWith("this.toInt().toChar()"))
|
||||
public override fun toChar(): Char
|
||||
/** Returns this value. */
|
||||
public override fun toShort(): Short
|
||||
@@ -966,6 +969,8 @@ public class Float private constructor() : Number(), Comparable<Float> {
|
||||
*
|
||||
* The resulting `Char` value is equal to `this.toInt().toChar()`.
|
||||
*/
|
||||
@Deprecated("Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", ReplaceWith("this.toInt().toChar()"))
|
||||
@DeprecatedSinceKotlin(warningSince = "1.5")
|
||||
public override fun toChar(): Char
|
||||
/**
|
||||
* Converts this [Float] value to [Short].
|
||||
@@ -1210,6 +1215,8 @@ public class Double private constructor() : Number(), Comparable<Double> {
|
||||
*
|
||||
* The resulting `Char` value is equal to `this.toInt().toChar()`.
|
||||
*/
|
||||
@Deprecated("Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", ReplaceWith("this.toInt().toChar()"))
|
||||
@DeprecatedSinceKotlin(warningSince = "1.5")
|
||||
public override fun toChar(): Char
|
||||
/**
|
||||
* Converts this [Double] value to [Short].
|
||||
|
||||
@@ -262,6 +262,8 @@ public class Long internal constructor(
|
||||
public fun inv(): Long = Long(low.inv(), high.inv())
|
||||
|
||||
public override fun toByte(): Byte = low.toByte()
|
||||
@Deprecated("Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead.", ReplaceWith("this.toInt().toChar()"))
|
||||
@DeprecatedSinceKotlin(warningSince = "1.5")
|
||||
public override fun toChar(): Char = low.toChar()
|
||||
public override fun toShort(): Short = low.toShort()
|
||||
public override fun toInt(): Int = low
|
||||
|
||||
@@ -19,7 +19,7 @@ private object Category {
|
||||
val toBase64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
|
||||
val fromBase64 = IntArray(128)
|
||||
for (i in toBase64.indices) {
|
||||
fromBase64[toBase64[i].toInt()] = i
|
||||
fromBase64[toBase64[i].code] = i
|
||||
}
|
||||
|
||||
// rangeStartDiff.length = 1482
|
||||
@@ -54,7 +54,7 @@ private fun categoryValueFrom(code: Int, ch: Int): Int {
|
||||
* Returns the Unicode general category of this character as an Int.
|
||||
*/
|
||||
internal fun Char.getCategoryValue(): Int {
|
||||
val ch = this.toInt()
|
||||
val ch = this.code
|
||||
|
||||
val index = binarySearchRange(Category.decodedRangeStart, ch)
|
||||
val start = Category.decodedRangeStart[index]
|
||||
@@ -70,7 +70,7 @@ internal fun decodeVarLenBase64(base64: String, fromBase64: IntArray, resultLeng
|
||||
var int = 0
|
||||
var shift = 0
|
||||
for (char in base64) {
|
||||
val sixBit = fromBase64[char.toInt()]
|
||||
val sixBit = fromBase64[char.code]
|
||||
int = int or ((sixBit and 0x1f) shl shift)
|
||||
if (sixBit < 0x20) {
|
||||
result[index++] = int
|
||||
|
||||
@@ -40,7 +40,7 @@ internal fun binarySearchRange(array: IntArray, needle: Int): Int {
|
||||
* Returns `true` if this character is a digit.
|
||||
*/
|
||||
internal fun Char.isDigitImpl(): Boolean {
|
||||
val ch = this.toInt()
|
||||
val ch = this.code
|
||||
val index = binarySearchRange(Digit.rangeStart, ch)
|
||||
val high = Digit.rangeStart[index] + 9
|
||||
return ch <= high
|
||||
|
||||
@@ -20,7 +20,7 @@ private object Letter {
|
||||
val toBase64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
|
||||
val fromBase64 = IntArray(128)
|
||||
for (i in toBase64.indices) {
|
||||
fromBase64[toBase64[i].toInt()] = i
|
||||
fromBase64[toBase64[i].code] = i
|
||||
}
|
||||
|
||||
// rangeStartDiff.length = 356
|
||||
@@ -72,7 +72,7 @@ internal fun Char.isUpperCaseImpl(): Boolean {
|
||||
* - `0` otherwise.
|
||||
*/
|
||||
private fun Char.getLetterType(): Int {
|
||||
val ch = this.toInt()
|
||||
val ch = this.code
|
||||
val index = binarySearchRange(Letter.decodedRangeStart, ch)
|
||||
|
||||
val rangeStart = Letter.decodedRangeStart[index]
|
||||
|
||||
@@ -13,7 +13,7 @@ package kotlin.text
|
||||
// 4 ranges totally
|
||||
@OptIn(ExperimentalStdlibApi::class)
|
||||
internal fun Char.titlecaseCharImpl(): Char {
|
||||
val code = this.toInt()
|
||||
val code = this.code
|
||||
// Letters repeating <Lu, Lt, Ll> sequence and code of the Lt is a multiple of 3, e.g. <DŽ, Dž, dž>
|
||||
if (code in 0x01c4..0x01cc || code in 0x01f1..0x01f3) {
|
||||
return (3 * ((code + 1) / 3)).toChar()
|
||||
|
||||
@@ -15,7 +15,7 @@ package kotlin.text
|
||||
* Returns `true` if this character is a whitespace.
|
||||
*/
|
||||
internal fun Char.isWhitespaceImpl(): Boolean {
|
||||
val ch = this.toInt()
|
||||
val ch = this.code
|
||||
return ch in 0x0009..0x000d
|
||||
|| ch in 0x001c..0x0020
|
||||
|| ch == 0x00a0
|
||||
|
||||
@@ -19,7 +19,7 @@ private object Category {
|
||||
val toBase64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
|
||||
val fromBase64 = IntArray(128)
|
||||
for (i in toBase64.indices) {
|
||||
fromBase64[toBase64[i].toInt()] = i
|
||||
fromBase64[toBase64[i].code] = i
|
||||
}
|
||||
|
||||
// rangeStartDiff.length = 1482
|
||||
@@ -54,7 +54,7 @@ private fun categoryValueFrom(code: Int, ch: Int): Int {
|
||||
* Returns the Unicode general category of this character as an Int.
|
||||
*/
|
||||
internal fun Char.getCategoryValue(): Int {
|
||||
val ch = this.toInt()
|
||||
val ch = this.code
|
||||
|
||||
val index = binarySearchRange(Category.decodedRangeStart, ch)
|
||||
val start = Category.decodedRangeStart[index]
|
||||
@@ -70,7 +70,7 @@ internal fun decodeVarLenBase64(base64: String, fromBase64: IntArray, resultLeng
|
||||
var int = 0
|
||||
var shift = 0
|
||||
for (char in base64) {
|
||||
val sixBit = fromBase64[char.toInt()]
|
||||
val sixBit = fromBase64[char.code]
|
||||
int = int or ((sixBit and 0x1f) shl shift)
|
||||
if (sixBit < 0x20) {
|
||||
result[index++] = int
|
||||
|
||||
@@ -40,7 +40,7 @@ internal fun binarySearchRange(array: IntArray, needle: Int): Int {
|
||||
* Returns `true` if this character is a digit.
|
||||
*/
|
||||
internal fun Char.isDigitImpl(): Boolean {
|
||||
val ch = this.toInt()
|
||||
val ch = this.code
|
||||
val index = binarySearchRange(Digit.rangeStart, ch)
|
||||
val high = Digit.rangeStart[index] + 9
|
||||
return ch <= high
|
||||
|
||||
@@ -20,7 +20,7 @@ private object Letter {
|
||||
val toBase64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
|
||||
val fromBase64 = IntArray(128)
|
||||
for (i in toBase64.indices) {
|
||||
fromBase64[toBase64[i].toInt()] = i
|
||||
fromBase64[toBase64[i].code] = i
|
||||
}
|
||||
|
||||
// rangeStartDiff.length = 356
|
||||
@@ -72,7 +72,7 @@ internal fun Char.isUpperCaseImpl(): Boolean {
|
||||
* - `0` otherwise.
|
||||
*/
|
||||
private fun Char.getLetterType(): Int {
|
||||
val ch = this.toInt()
|
||||
val ch = this.code
|
||||
val index = binarySearchRange(Letter.decodedRangeStart, ch)
|
||||
|
||||
val rangeStart = Letter.decodedRangeStart[index]
|
||||
|
||||
@@ -13,7 +13,7 @@ package kotlin.text
|
||||
// 4 ranges totally
|
||||
@OptIn(ExperimentalStdlibApi::class)
|
||||
internal fun Char.titlecaseCharImpl(): Char {
|
||||
val code = this.toInt()
|
||||
val code = this.code
|
||||
// Letters repeating <Lu, Lt, Ll> sequence and code of the Lt is a multiple of 3, e.g. <DŽ, Dž, dž>
|
||||
if (code in 0x01c4..0x01cc || code in 0x01f1..0x01f3) {
|
||||
return (3 * ((code + 1) / 3)).toChar()
|
||||
|
||||
@@ -15,7 +15,7 @@ package kotlin.text
|
||||
* Returns `true` if this character is a whitespace.
|
||||
*/
|
||||
internal fun Char.isWhitespaceImpl(): Boolean {
|
||||
val ch = this.toInt()
|
||||
val ch = this.code
|
||||
return ch in 0x0009..0x000d
|
||||
|| ch in 0x001c..0x0020
|
||||
|| ch == 0x00a0
|
||||
|
||||
@@ -23,7 +23,7 @@ private fun codePointFromSurrogate(string: String, high: Int, index: Int, endInd
|
||||
if (high !in 0xD800..0xDBFF || index >= endIndex) {
|
||||
return malformed(0, index, throwOnMalformed)
|
||||
}
|
||||
val low = string[index].toInt()
|
||||
val low = string[index].code
|
||||
if (low !in 0xDC00..0xDFFF) {
|
||||
return malformed(0, index, throwOnMalformed)
|
||||
}
|
||||
@@ -169,7 +169,7 @@ internal fun encodeUtf8(string: String, startIndex: Int, endIndex: Int, throwOnM
|
||||
var charIndex = startIndex
|
||||
|
||||
while (charIndex < endIndex) {
|
||||
val code = string[charIndex++].toInt()
|
||||
val code = string[charIndex++].code
|
||||
when {
|
||||
code < 0x80 ->
|
||||
bytes[byteIndex++] = code.toByte()
|
||||
|
||||
@@ -183,7 +183,7 @@ internal object LineReader {
|
||||
bytes[nBytes++] = readByte.toByte()
|
||||
}
|
||||
// With "directEOL" encoding bytes are batched before being decoded all at once
|
||||
if (readByte == '\n'.toInt() || nBytes == BUFFER_SIZE || !directEOL) {
|
||||
if (readByte == '\n'.code || nBytes == BUFFER_SIZE || !directEOL) {
|
||||
// Decode the bytes that were read
|
||||
byteBuf.limit(nBytes) // byteBuf position is always zero
|
||||
charBuf.position(nChars) // charBuf limit is always BUFFER_SIZE
|
||||
@@ -254,7 +254,7 @@ internal object LineReader {
|
||||
// try decoding ASCII line separator to see if this charset (like UTF-8) encodes it directly
|
||||
byteBuf.clear()
|
||||
charBuf.clear()
|
||||
byteBuf.put('\n'.toByte())
|
||||
byteBuf.put('\n'.code.toByte())
|
||||
byteBuf.flip()
|
||||
decoder.decode(byteBuf, charBuf, false)
|
||||
directEOL = charBuf.position() == 1 && charBuf.get(0) == '\n'
|
||||
|
||||
@@ -288,7 +288,7 @@ public actual inline fun Char.isLowSurrogate(): Boolean = Character.isLowSurroga
|
||||
|
||||
|
||||
|
||||
internal actual fun digitOf(char: Char, radix: Int): Int = Character.digit(char.toInt(), radix)
|
||||
internal actual fun digitOf(char: Char, radix: Int): Int = Character.digit(char.code, radix)
|
||||
|
||||
/**
|
||||
* Checks whether the given [radix] is valid radix for string to number and number to string conversion.
|
||||
|
||||
@@ -21,7 +21,7 @@ import java.util.regex.Pattern
|
||||
* Returns the index within this string of the first occurrence of the specified character, starting from the specified offset.
|
||||
*/
|
||||
@kotlin.internal.InlineOnly
|
||||
internal actual inline fun String.nativeIndexOf(ch: Char, fromIndex: Int): Int = (this as java.lang.String).indexOf(ch.toInt(), fromIndex)
|
||||
internal actual inline fun String.nativeIndexOf(ch: Char, fromIndex: Int): Int = (this as java.lang.String).indexOf(ch.code, fromIndex)
|
||||
|
||||
/**
|
||||
* Returns the index within this string of the first occurrence of the specified substring, starting from the specified offset.
|
||||
@@ -33,7 +33,7 @@ internal actual inline fun String.nativeIndexOf(str: String, fromIndex: Int): In
|
||||
* Returns the index within this string of the last occurrence of the specified character.
|
||||
*/
|
||||
@kotlin.internal.InlineOnly
|
||||
internal actual inline fun String.nativeLastIndexOf(ch: Char, fromIndex: Int): Int = (this as java.lang.String).lastIndexOf(ch.toInt(), fromIndex)
|
||||
internal actual inline fun String.nativeLastIndexOf(ch: Char, fromIndex: Int): Int = (this as java.lang.String).lastIndexOf(ch.code, fromIndex)
|
||||
|
||||
/**
|
||||
* Returns the index within this string of the last occurrence of the specified character, starting from the specified offset.
|
||||
|
||||
@@ -84,7 +84,7 @@ class ReadWriteTest {
|
||||
//file.replaceText("Hello\nWorld")
|
||||
file.forEachBlock { arr: ByteArray, size: Int ->
|
||||
assertTrue(size >= 11 && size <= 12, size.toString())
|
||||
assertTrue(arr.contains('W'.toByte()))
|
||||
assertTrue(arr.contains('W'.code.toByte()))
|
||||
}
|
||||
val list = ArrayList<String>()
|
||||
file.forEachLine(Charsets.UTF_8, {
|
||||
|
||||
@@ -68,7 +68,7 @@ class Arrays {
|
||||
fun associateArrayOfPrimitives() {
|
||||
val charCodes = intArrayOf(72, 69, 76, 76, 79)
|
||||
|
||||
val byCharCode = charCodes.associate { it to it.toChar() }
|
||||
val byCharCode = charCodes.associate { it to Char(it) }
|
||||
|
||||
// 76=L only occurs once because only the last pair with the same key gets added
|
||||
assertPrints(byCharCode, "{72=H, 69=E, 76=L, 79=O}")
|
||||
@@ -79,7 +79,7 @@ class Arrays {
|
||||
fun associateArrayOfPrimitivesBy() {
|
||||
val charCodes = intArrayOf(72, 69, 76, 76, 79)
|
||||
|
||||
val byChar = charCodes.associateBy { it.toChar() }
|
||||
val byChar = charCodes.associateBy { Char(it) }
|
||||
|
||||
// L=76 only occurs once because only the last pair with the same key gets added
|
||||
assertPrints(byChar, "{H=72, E=69, L=76, O=79}")
|
||||
@@ -89,7 +89,7 @@ class Arrays {
|
||||
fun associateArrayOfPrimitivesByWithValueTransform() {
|
||||
val charCodes = intArrayOf(65, 65, 66, 67, 68, 69)
|
||||
|
||||
val byUpperCase = charCodes.associateBy({ it.toChar() }, { (it + 32).toChar() })
|
||||
val byUpperCase = charCodes.associateBy({ Char(it) }, { Char(it + 32) })
|
||||
|
||||
// A=a only occurs once because only the last pair with the same key gets added
|
||||
assertPrints(byUpperCase, "{A=a, B=b, C=c, D=d, E=e}")
|
||||
@@ -101,7 +101,7 @@ class Arrays {
|
||||
val byChar = mutableMapOf<Char, Int>()
|
||||
|
||||
assertTrue(byChar.isEmpty())
|
||||
charCodes.associateByTo(byChar) { it.toChar() }
|
||||
charCodes.associateByTo(byChar) { Char(it) }
|
||||
|
||||
assertTrue(byChar.isNotEmpty())
|
||||
// L=76 only occurs once because only the last pair with the same key gets added
|
||||
@@ -113,7 +113,7 @@ class Arrays {
|
||||
val charCodes = intArrayOf(65, 65, 66, 67, 68, 69)
|
||||
|
||||
val byUpperCase = mutableMapOf<Char, Char>()
|
||||
charCodes.associateByTo(byUpperCase, { it.toChar() }, { (it + 32).toChar() } )
|
||||
charCodes.associateByTo(byUpperCase, { Char(it) }, { Char(it + 32) })
|
||||
|
||||
// A=a only occurs once because only the last pair with the same key gets added
|
||||
assertPrints(byUpperCase, "{A=a, B=b, C=c, D=d, E=e}")
|
||||
@@ -124,7 +124,7 @@ class Arrays {
|
||||
val charCodes = intArrayOf(72, 69, 76, 76, 79)
|
||||
|
||||
val byChar = mutableMapOf<Int, Char>()
|
||||
charCodes.associateTo(byChar) { it to it.toChar() }
|
||||
charCodes.associateTo(byChar) { it to Char(it) }
|
||||
|
||||
// 76=L only occurs once because only the last pair with the same key gets added
|
||||
assertPrints(byChar, "{72=H, 69=E, 76=L, 79=O}")
|
||||
|
||||
@@ -35,7 +35,7 @@ class Chars {
|
||||
val chars = listOf('\u0000', '\u000E', '\u0009', '1', 'a')
|
||||
val (isoControls, notIsoControls) = chars.partition { it.isISOControl() }
|
||||
// some ISO-control char codes
|
||||
assertPrints(isoControls.map(Char::toInt), "[0, 14, 9]")
|
||||
assertPrints(isoControls.map(Char::code), "[0, 14, 9]")
|
||||
// non-ISO-control chars
|
||||
assertPrints(notIsoControls, "[1, a]")
|
||||
}
|
||||
@@ -61,7 +61,7 @@ class Chars {
|
||||
val chars = listOf(' ', '\t', '\n', '1', 'a', '\u00A0')
|
||||
val (whitespaces, notWhitespaces) = chars.partition { it.isWhitespace() }
|
||||
// whitespace char codes
|
||||
assertPrints(whitespaces.map(Char::toInt), "[32, 9, 10, 160]")
|
||||
assertPrints(whitespaces.map(Char::code), "[32, 9, 10, 160]")
|
||||
// non-whitespace chars
|
||||
assertPrints(notWhitespaces, "[1, a]")
|
||||
}
|
||||
|
||||
@@ -126,7 +126,7 @@ class Strings {
|
||||
fun associate() {
|
||||
val string = "bonne journée"
|
||||
// associate each character with its code
|
||||
val result = string.associate { char -> char to char.toInt() }
|
||||
val result = string.associate { char -> char to char.code }
|
||||
// notice each letter occurs only once
|
||||
assertPrints(result, "{b=98, o=111, n=110, e=101, =32, j=106, u=117, r=114, é=233}")
|
||||
}
|
||||
@@ -135,7 +135,7 @@ class Strings {
|
||||
fun associateBy() {
|
||||
val string = "bonne journée"
|
||||
// associate each character by its code
|
||||
val result = string.associateBy { char -> char.toInt() }
|
||||
val result = string.associateBy { char -> char.code }
|
||||
// notice each char code occurs only once
|
||||
assertPrints(result, "{98=b, 111=o, 110=n, 101=e, 32= , 106=j, 117=u, 114=r, 233=é}")
|
||||
}
|
||||
@@ -144,7 +144,7 @@ class Strings {
|
||||
fun associateByWithValueTransform() {
|
||||
val string = "bonne journée"
|
||||
// associate each character by the code of its upper case equivalent and transform the character to upper case
|
||||
val result = string.associateBy({ char -> char.toUpperCase().toInt() }, { char -> char.toUpperCase() })
|
||||
val result = string.associateBy({ char -> char.uppercaseChar().code }, { char -> char.uppercaseChar() })
|
||||
// notice each char code occurs only once
|
||||
assertPrints(result, "{66=B, 79=O, 78=N, 69=E, 32= , 74=J, 85=U, 82=R, 201=É}")
|
||||
}
|
||||
@@ -154,7 +154,7 @@ class Strings {
|
||||
val string = "bonne journée"
|
||||
// associate each character by its code
|
||||
val result = mutableMapOf<Int, Char>()
|
||||
string.associateByTo(result) { char -> char.toInt() }
|
||||
string.associateByTo(result) { char -> char.code }
|
||||
// notice each char code occurs only once
|
||||
assertPrints(result, "{98=b, 111=o, 110=n, 101=e, 32= , 106=j, 117=u, 114=r, 233=é}")
|
||||
}
|
||||
@@ -164,7 +164,7 @@ class Strings {
|
||||
val string = "bonne journée"
|
||||
// associate each character by the code of its upper case equivalent and transform the character to upper case
|
||||
val result = mutableMapOf<Int, Char>()
|
||||
string.associateByTo(result, { char -> char.toUpperCase().toInt() }, { char -> char.toUpperCase() })
|
||||
string.associateByTo(result, { char -> char.uppercaseChar().code }, { char -> char.uppercaseChar() })
|
||||
// notice each char code occurs only once
|
||||
assertPrints(result, "{66=B, 79=O, 78=N, 69=E, 32= , 74=J, 85=U, 82=R, 201=É}")
|
||||
}
|
||||
@@ -174,7 +174,7 @@ class Strings {
|
||||
val string = "bonne journée"
|
||||
// associate each character with its code
|
||||
val result = mutableMapOf<Char, Int>()
|
||||
string.associateTo(result) { char -> char to char.toInt() }
|
||||
string.associateTo(result) { char -> char to char.code }
|
||||
// notice each letter occurs only once
|
||||
assertPrints(result, "{b=98, o=111, n=110, e=101, =32, j=106, u=117, r=114, é=233}")
|
||||
}
|
||||
@@ -183,7 +183,7 @@ class Strings {
|
||||
fun associateWith() {
|
||||
val string = "bonne journée"
|
||||
// associate each character with its code
|
||||
val result = string.associateWith { char -> char.toInt() }
|
||||
val result = string.associateWith { char -> char.code }
|
||||
// notice each letter occurs only once
|
||||
assertPrints(result, "{b=98, o=111, n=110, e=101, =32, j=106, u=117, r=114, é=233}")
|
||||
}
|
||||
@@ -193,7 +193,7 @@ class Strings {
|
||||
val string = "bonne journée"
|
||||
// associate each character with its code
|
||||
val result = mutableMapOf<Char, Int>()
|
||||
string.associateWithTo(result) { char -> char.toInt() }
|
||||
string.associateWithTo(result) { char -> char.code }
|
||||
// notice each letter occurs only once
|
||||
assertPrints(result, "{b=98, o=111, n=110, e=101, =32, j=106, u=117, r=114, é=233}")
|
||||
}
|
||||
@@ -414,7 +414,7 @@ class Strings {
|
||||
@Sample
|
||||
fun map() {
|
||||
val string = "kotlin"
|
||||
assertPrints(string.map { it.toUpperCase() }, "[K, O, T, L, I, N]")
|
||||
assertPrints(string.map { it.uppercaseChar() }, "[K, O, T, L, I, N]")
|
||||
}
|
||||
|
||||
@Sample
|
||||
|
||||
@@ -45,4 +45,5 @@ public expect fun Char(code: UShort): Char
|
||||
@SinceKotlin("1.5")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
@kotlin.internal.InlineOnly
|
||||
@Suppress("DEPRECATION")
|
||||
public inline val Char.code: Int get() = this.toInt()
|
||||
|
||||
@@ -149,16 +149,16 @@ class AbstractCollectionsTest {
|
||||
@Test
|
||||
fun abstractMutableMap() {
|
||||
val map = MutMap()
|
||||
for (e in 'a'..'z') map[e.toString()] = e.toInt()
|
||||
for (e in 'a'..'z') map[e.toString()] = e.code
|
||||
assertEquals(26, map.size)
|
||||
|
||||
map.remove("a")
|
||||
map.keys.remove("b")
|
||||
map.keys.removeAll { it == "c" }
|
||||
|
||||
map.values.remove('d'.toInt())
|
||||
map.values.remove('d'.code)
|
||||
assertTrue(map.containsKey("e"))
|
||||
assertTrue(map.containsValue('f'.toInt()))
|
||||
assertTrue(map.containsValue('f'.code))
|
||||
|
||||
compare(map.storage, map) {
|
||||
mapBehavior()
|
||||
|
||||
@@ -1156,7 +1156,7 @@ class ArraysTest {
|
||||
assertEquals(expected, FloatArray(size) { it.toFloat() }.scan("") { acc, e -> acc + e.toInt() })
|
||||
assertEquals(expected, DoubleArray(size) { it.toDouble() }.scan("") { acc, e -> acc + e.toInt() })
|
||||
assertEquals(
|
||||
expected.map { it.map { c -> c.toInt() % 2 == 0 }.joinToString(separator = "") },
|
||||
expected.map { it.map { c -> c.code % 2 == 0 }.joinToString(separator = "") },
|
||||
BooleanArray(size) { it % 2 == 0 }.scan("") { acc, e -> acc + e }
|
||||
)
|
||||
}
|
||||
@@ -1177,7 +1177,7 @@ class ArraysTest {
|
||||
assertEquals(expected, FloatArray(size) { it.toFloat() }.runningFold("") { acc, e -> acc + e.toInt() })
|
||||
assertEquals(expected, DoubleArray(size) { it.toDouble() }.runningFold("") { acc, e -> acc + e.toInt() })
|
||||
assertEquals(
|
||||
expected.map { it.map { c -> c.toInt() % 2 == 0 }.joinToString(separator = "") },
|
||||
expected.map { it.map { c -> c.code % 2 == 0 }.joinToString(separator = "") },
|
||||
BooleanArray(size) { it % 2 == 0 }.runningFold("") { acc, e -> acc + e }
|
||||
)
|
||||
}
|
||||
@@ -1199,7 +1199,7 @@ class ArraysTest {
|
||||
)
|
||||
assertEquals(
|
||||
expected,
|
||||
CharArray(size) { it.toChar() }.scanIndexed("+") { index, acc, e -> "$acc[$index: ${'a' + e.toInt()}]" }
|
||||
CharArray(size) { Char(it) }.scanIndexed("+") { index, acc, e -> "$acc[$index: ${'a' + e.code}]" }
|
||||
)
|
||||
assertEquals(
|
||||
expected,
|
||||
@@ -1222,7 +1222,7 @@ class ArraysTest {
|
||||
DoubleArray(size) { it.toDouble() }.scanIndexed("+") { index, acc, e -> "$acc[$index: ${'a' + e.toInt()}]" }
|
||||
)
|
||||
assertEquals(
|
||||
expected.map { it.map { c -> if (c.isAsciiLetter()) c.toInt() % 2 != 0 else c }.joinToString(separator = "") },
|
||||
expected.map { it.map { c -> if (c.isAsciiLetter()) c.code % 2 != 0 else c }.joinToString(separator = "") },
|
||||
BooleanArray(size) { it % 2 == 0 }.scanIndexed("+") { index, acc, e -> "$acc[$index: $e]" }
|
||||
)
|
||||
}
|
||||
@@ -1244,7 +1244,7 @@ class ArraysTest {
|
||||
)
|
||||
assertEquals(
|
||||
expected,
|
||||
CharArray(size) { it.toChar() }.runningFoldIndexed("+") { index, acc, e -> "$acc[$index: ${'a' + e.toInt()}]" }
|
||||
CharArray(size) { Char(it) }.runningFoldIndexed("+") { index, acc, e -> "$acc[$index: ${'a' + e.code}]" }
|
||||
)
|
||||
assertEquals(
|
||||
expected,
|
||||
@@ -1267,7 +1267,7 @@ class ArraysTest {
|
||||
DoubleArray(size) { it.toDouble() }.runningFoldIndexed("+") { index, acc, e -> "$acc[$index: ${'a' + e.toInt()}]" }
|
||||
)
|
||||
assertEquals(
|
||||
expected.map { it.map { c -> if (c.isAsciiLetter()) c.toInt() % 2 != 0 else c }.joinToString(separator = "") },
|
||||
expected.map { it.map { c -> if (c.isAsciiLetter()) c.code % 2 != 0 else c }.joinToString(separator = "") },
|
||||
BooleanArray(size) { it % 2 == 0 }.runningFoldIndexed("+") { index, acc, e -> "$acc[$index: $e]" }
|
||||
)
|
||||
}
|
||||
@@ -1288,8 +1288,8 @@ class ArraysTest {
|
||||
ByteArray(size) { it.toByte() }.runningReduce { acc, e -> (acc + e).toByte() }
|
||||
)
|
||||
assertEquals(
|
||||
expected.map { it.toChar() },
|
||||
CharArray(size) { it.toChar() }.runningReduce { acc, e -> acc + e.toInt() }
|
||||
expected.map { Char(it) },
|
||||
CharArray(size) { Char(it) }.runningReduce { acc, e -> acc + e.code }
|
||||
)
|
||||
assertEquals(
|
||||
expected.map { it.toShort() },
|
||||
@@ -1332,8 +1332,8 @@ class ArraysTest {
|
||||
expected.map { it.toByte() },
|
||||
ByteArray(size) { it.toByte() }.runningReduceIndexed { index, acc, e -> (index * (acc + e)).toByte() })
|
||||
assertEquals(
|
||||
expected.map { it.toChar() },
|
||||
CharArray(size) { it.toChar() }.runningReduceIndexed { index, acc, e -> (index * (acc.toInt() + e.toInt())).toChar() }
|
||||
expected.map { Char(it) },
|
||||
CharArray(size) { Char(it) }.runningReduceIndexed { index, acc, e -> (index * (acc.code + e.code)).let(::Char) }
|
||||
)
|
||||
assertEquals(
|
||||
expected.map { it.toShort() },
|
||||
@@ -2177,7 +2177,7 @@ class ArraysTest {
|
||||
testShuffle(numbers.map(Int::toShort).toShortArray(), { shuffle() }, { toList() })
|
||||
testShuffle(numbers.map(Int::toFloat).toFloatArray(), { shuffle() }, { toList() })
|
||||
testShuffle(numbers.map(Int::toDouble).toDoubleArray(), { shuffle() }, { toList() })
|
||||
testShuffle(numbers.map(Int::toChar).toCharArray(), { shuffle() }, { toList() })
|
||||
testShuffle(numbers.map(::Char).toCharArray(), { shuffle() }, { toList() })
|
||||
testShuffle(numbers.map { it % 2 == 0 }.toBooleanArray(), { shuffle() }, { toList() })
|
||||
|
||||
testShuffle(numbers.map(Int::toUInt).toUIntArray(), { shuffle() }, { toList() })
|
||||
@@ -2207,7 +2207,7 @@ class ArraysTest {
|
||||
testShuffleR(numbers.map(Int::toShort).toShortArray(), { r -> shuffle(r) }, { toList() })
|
||||
testShuffleR(numbers.map(Int::toFloat).toFloatArray(), { r -> shuffle(r) }, { toList() })
|
||||
testShuffleR(numbers.map(Int::toDouble).toDoubleArray(), { r -> shuffle(r) }, { toList() })
|
||||
testShuffleR(numbers.map(Int::toChar).toCharArray(), { r -> shuffle(r) }, { toList() })
|
||||
testShuffleR(numbers.map(::Char).toCharArray(), { r -> shuffle(r) }, { toList() })
|
||||
testShuffleR(numbers.map { it % 2 == 0 }.toBooleanArray(), { r -> shuffle(r) }, { toList() })
|
||||
|
||||
testShuffleR(numbers.map(Int::toUInt).toUIntArray(), { r -> shuffle(r) }, { toList() })
|
||||
@@ -2244,7 +2244,7 @@ class ArraysTest {
|
||||
|
||||
testFailures(BooleanArray(5) { it % 2 == 0 }, BooleanArray::fill, true, 5)
|
||||
testFailures(ByteArray(5) { it.toByte() }, ByteArray::fill, 0.toByte(), 5)
|
||||
testFailures(CharArray(5) { it.toChar() }, CharArray::fill, 0.toChar(), 5)
|
||||
testFailures(CharArray(5) { Char(it) }, CharArray::fill, Char(0), 5)
|
||||
testFailures(FloatArray(5) { it.toFloat() }, FloatArray::fill, 0.0f, 5)
|
||||
testFailures(DoubleArray(5) { it.toDouble() }, DoubleArray::fill, 0.0, 5)
|
||||
testFailures(ShortArray(5) { it.toShort() }, ShortArray::fill, 0.toShort(), 5)
|
||||
@@ -2278,7 +2278,7 @@ class ArraysTest {
|
||||
|
||||
test(array, BooleanArray::fill, operations, IntArray::toBooleanArray, { this % 2 == 0 }, BooleanArray::contentEquals)
|
||||
test(array, ByteArray::fill, operations, IntArray::toByteArray, Int::toByte, ByteArray::contentEquals)
|
||||
test(array, CharArray::fill, operations, IntArray::toCharArray, Int::toChar, CharArray::contentEquals)
|
||||
test(array, CharArray::fill, operations, IntArray::toCharArray, ::Char, CharArray::contentEquals)
|
||||
test(array, FloatArray::fill, operations, IntArray::toFloatArray, Int::toFloat, FloatArray::contentEquals)
|
||||
test(array, DoubleArray::fill, operations, IntArray::toDoubleArray, Int::toDouble, DoubleArray::contentEquals)
|
||||
test(array, ShortArray::fill, operations, IntArray::toShortArray, Int::toShort, ShortArray::contentEquals)
|
||||
@@ -2297,7 +2297,7 @@ class ArraysTest {
|
||||
|
||||
private fun IntArray.toBooleanArray() = BooleanArray(size) { get(it) % 2 == 0 }
|
||||
private fun IntArray.toByteArray() = ByteArray(size) { get(it).toByte() }
|
||||
private fun IntArray.toCharArray() = CharArray(size) { get(it).toChar() }
|
||||
private fun IntArray.toCharArray() = CharArray(size) { Char(get(it)) }
|
||||
private fun IntArray.toFloatArray() = FloatArray(size) { get(it).toFloat() }
|
||||
private fun IntArray.toDoubleArray() = DoubleArray(size) { get(it).toDouble() }
|
||||
private fun IntArray.toShortArray() = ShortArray(size) { get(it).toShort() }
|
||||
|
||||
@@ -30,7 +30,7 @@ class GroupingTest {
|
||||
verifyGrouping(elements.asSequence().groupingBy(keySelector))
|
||||
|
||||
val charSeq = "some sequence of chars"
|
||||
verifyGrouping(charSeq.groupingBy { it.toInt() }, charSeq.toList(), charSeq.map { it.toInt() })
|
||||
verifyGrouping(charSeq.groupingBy { it.code }, charSeq.toList(), charSeq.map { it.code })
|
||||
}
|
||||
|
||||
// aggregate and aggregateTo operations are not tested, but they're used in every other operation
|
||||
|
||||
@@ -128,8 +128,8 @@ class NumbersTest {
|
||||
}
|
||||
|
||||
@Test fun charMinMaxValues() {
|
||||
assertTrue(Char.MIN_VALUE.toInt() == 0)
|
||||
assertTrue(Char.MAX_VALUE.toInt() > 0)
|
||||
assertTrue(Char.MIN_VALUE.code == 0)
|
||||
assertTrue(Char.MAX_VALUE.code > 0)
|
||||
|
||||
// overflow behavior
|
||||
expect(Char.MIN_VALUE) { Char.MAX_VALUE + one }
|
||||
|
||||
@@ -205,7 +205,7 @@ class CharTest {
|
||||
@Test
|
||||
fun charCategory() {
|
||||
for ((char, categoryCode) in charToCategory()) {
|
||||
assertEquals(categoryCode, char.category.code, "char code: ${char.toInt().toString(radix = 16)}")
|
||||
assertEquals(categoryCode, char.category.code, "char code: ${char.code.toString(radix = 16)}")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ class StringEncodingTest {
|
||||
|
||||
// https://youtrack.jetbrains.com/issue/KT-31614
|
||||
private fun string(vararg codeUnits: Int): String {
|
||||
return buildString { codeUnits.forEach { append(it.toChar()) } }
|
||||
return buildString { codeUnits.forEach { append(Char(it)) } }
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ internal class OneToManyUppercaseMappingsWriter(private val strategy: RangesWrit
|
||||
return null
|
||||
}
|
||||
|
||||
val code = this.toInt()
|
||||
val code = this.code
|
||||
val index = binarySearchRange(keys, code)
|
||||
if (keys[index] == code) {
|
||||
return values[index]
|
||||
|
||||
+1
-1
@@ -46,7 +46,7 @@ internal class LowercaseMappingsWriter(private val strategy: RangesWritingStrate
|
||||
|
||||
private fun lowercaseCharImpl(): String = """
|
||||
internal fun Char.lowercaseCharImpl(): Char {
|
||||
return toInt().lowercaseCodePoint().toChar()
|
||||
return code.lowercaseCodePoint().toChar()
|
||||
}
|
||||
""".trimIndent()
|
||||
}
|
||||
+1
-1
@@ -24,7 +24,7 @@ internal class TitlecaseMappingsWriter : MappingsWriter {
|
||||
"""
|
||||
@OptIn(ExperimentalStdlibApi::class)
|
||||
internal fun Char.titlecaseCharImpl(): Char {
|
||||
val code = this.toInt()
|
||||
val code = this.code
|
||||
// Letters repeating <Lu, Lt, Ll> sequence and code of the Lt is a multiple of 3, e.g. <DŽ, Dž, dž>
|
||||
if (${rangeChecks(LuLtLlMappings, "code")}) {
|
||||
return (3 * ((code + 1) / 3)).toChar()
|
||||
|
||||
+1
-1
@@ -67,7 +67,7 @@ internal class UppercaseMappingsWriter(private val strategy: RangesWritingStrate
|
||||
|
||||
private fun uppercaseCharImpl(): String = """
|
||||
internal fun Char.uppercaseCharImpl(): Char {
|
||||
return toInt().uppercaseCodePoint().toChar()
|
||||
return code.uppercaseCodePoint().toChar()
|
||||
}
|
||||
""".trimIndent()
|
||||
}
|
||||
+3
-3
@@ -94,7 +94,7 @@ internal class StringLowercaseGenerator(
|
||||
// Lu + Ll + Lt + Other_Lowercase + Other_Uppercase (PropList.txt of Unicode Character Database files)
|
||||
// Declared internal for testing
|
||||
internal fun Int.isCased(): Boolean {
|
||||
if (this <= Char.MAX_VALUE.toInt()) {
|
||||
if (this <= Char.MAX_VALUE.code) {
|
||||
when (toChar().getCategoryValue()) {
|
||||
CharCategory.UPPERCASE_LETTER.value,
|
||||
CharCategory.LOWERCASE_LETTER.value,
|
||||
@@ -110,7 +110,7 @@ internal class StringLowercaseGenerator(
|
||||
// Mn + Me + Cf + Lm + Sk + Word_Break=MidLetter + Word_Break=MidNumLet + Word_Break=Single_Quote (WordBreakProperty.txt of Unicode Character Database files)
|
||||
// Declared internal for testing
|
||||
internal fun Int.isCaseIgnorable(): Boolean {
|
||||
if (this <= Char.MAX_VALUE.toInt()) {
|
||||
if (this <= Char.MAX_VALUE.code) {
|
||||
when (toChar().getCategoryValue()) {
|
||||
CharCategory.NON_SPACING_MARK.value,
|
||||
CharCategory.ENCLOSING_MARK.value,
|
||||
@@ -133,7 +133,7 @@ internal class StringLowercaseGenerator(
|
||||
return Char.toCodePoint(high, low)
|
||||
}
|
||||
}
|
||||
return low.toInt()
|
||||
return low.code
|
||||
}
|
||||
""".trimIndent()
|
||||
|
||||
|
||||
+1
-1
@@ -51,7 +51,7 @@ internal class StringUppercaseGenerator(
|
||||
return Char.toCodePoint(high, low)
|
||||
}
|
||||
}
|
||||
return high.toInt()
|
||||
return high.code
|
||||
}
|
||||
""".trimIndent()
|
||||
|
||||
|
||||
+1
-1
@@ -93,7 +93,7 @@ class CharCategoryTest {
|
||||
properties = null
|
||||
}
|
||||
|
||||
val charCode = char.toInt().toString(radix = 16).padStart(length = 4, padChar = '0')
|
||||
val charCode = char.code.toString(radix = 16).padStart(length = 4, padChar = '0')
|
||||
val expectedCategoryCode = properties?.categoryCode ?: CharCategory.UNASSIGNED.code
|
||||
|
||||
fun <T> test(expected: T, actual: T, name: String) {
|
||||
|
||||
+3
-3
@@ -69,7 +69,7 @@ internal open class CategoryRangesWriter(protected val strategy: RangesWritingSt
|
||||
* Returns the Unicode general category of this character as an Int.
|
||||
*/
|
||||
internal fun Char.getCategoryValue(): Int {
|
||||
val ch = this.toInt()
|
||||
val ch = this.code
|
||||
|
||||
val index = ${indexOf("ch")}
|
||||
val start = ${startAt("index")}
|
||||
@@ -116,7 +116,7 @@ internal class VarLenBase64CategoryRangesWriter(strategy: RangesWritingStrategy)
|
||||
val toBase64 = "$TO_BASE64"
|
||||
val fromBase64 = IntArray(128)
|
||||
for (i in toBase64.indices) {
|
||||
fromBase64[toBase64[i].toInt()] = i
|
||||
fromBase64[toBase64[i].code] = i
|
||||
}
|
||||
|
||||
// rangeStartDiff.length = ${base64RangeLength.length}
|
||||
@@ -147,7 +147,7 @@ internal class VarLenBase64CategoryRangesWriter(strategy: RangesWritingStrategy)
|
||||
var int = 0
|
||||
var shift = 0
|
||||
for (char in base64) {
|
||||
val sixBit = fromBase64[char.toInt()]
|
||||
val sixBit = fromBase64[char.code]
|
||||
int = int or ((sixBit and 0x1f) shl shift)
|
||||
if (sixBit < 0x20) {
|
||||
result[index++] = int
|
||||
|
||||
+1
-1
@@ -51,7 +51,7 @@ internal class DigitRangesWriter(private val strategy: RangesWritingStrategy) :
|
||||
* Returns `true` if this character is a digit.
|
||||
*/
|
||||
internal fun Char.isDigitImpl(): Boolean {
|
||||
val ch = this.toInt()
|
||||
val ch = this.code
|
||||
val index = binarySearchRange($rangeStart, ch)
|
||||
val high = $rangeStart[index] + 9
|
||||
return ch <= high
|
||||
|
||||
+2
-2
@@ -81,7 +81,7 @@ internal open class LetterRangesWriter(protected val strategy: RangesWritingStra
|
||||
* - `0` otherwise.
|
||||
*/
|
||||
private fun Char.getLetterType(): Int {
|
||||
val ch = this.toInt()
|
||||
val ch = this.code
|
||||
val index = ${indexOf("ch")}
|
||||
|
||||
val rangeStart = ${startAt("index")}
|
||||
@@ -164,7 +164,7 @@ internal class VarLenBase64LetterRangesWriter(strategy: RangesWritingStrategy) :
|
||||
val toBase64 = "$TO_BASE64"
|
||||
val fromBase64 = IntArray(128)
|
||||
for (i in toBase64.indices) {
|
||||
fromBase64[toBase64[i].toInt()] = i
|
||||
fromBase64[toBase64[i].code] = i
|
||||
}
|
||||
|
||||
// rangeStartDiff.length = ${base64RangeStartDiff.length}
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@ internal class WhitespaceRangesWriter : RangesWriter {
|
||||
* Returns `true` if this character is a whitespace.
|
||||
*/
|
||||
internal fun Char.isWhitespaceImpl(): Boolean {
|
||||
val ch = this.toInt()
|
||||
val ch = this.code
|
||||
return $checks
|
||||
}
|
||||
""".trimIndent()
|
||||
|
||||
@@ -988,7 +988,7 @@ object Elements : TemplateGroupBase() {
|
||||
specialFor(RangesOfPrimitives) {
|
||||
body {
|
||||
val expr = when (primitive) {
|
||||
PrimitiveType.Char -> "nextInt(first.toInt(), last.toInt() + 1).toChar()"
|
||||
PrimitiveType.Char -> "nextInt(first.code, last.code + 1).toChar()"
|
||||
else -> "next$primitive(this)"
|
||||
}
|
||||
"""
|
||||
@@ -1033,7 +1033,7 @@ object Elements : TemplateGroupBase() {
|
||||
specialFor(RangesOfPrimitives) {
|
||||
body {
|
||||
val expr = when (primitive) {
|
||||
PrimitiveType.Char -> "nextInt(first.toInt(), last.toInt() + 1).toChar()"
|
||||
PrimitiveType.Char -> "nextInt(first.code, last.code + 1).toChar()"
|
||||
else -> "next$primitive(this)"
|
||||
}
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user