From 7986598591edc663e800ed064e5f2f69f83989ca Mon Sep 17 00:00:00 2001 From: Svyatoslav Scherbina Date: Wed, 11 Jan 2017 13:37:56 +0700 Subject: [PATCH] runtime: add missing `toChar` implementations (required for boxes) --- runtime/src/main/cpp/Operator.cpp | 3 +++ runtime/src/main/kotlin/kotlin/Primitives.kt | 6 ++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/runtime/src/main/cpp/Operator.cpp b/runtime/src/main/cpp/Operator.cpp index 2c92a7f676e..d3e9b49c479 100644 --- a/runtime/src/main/cpp/Operator.cpp +++ b/runtime/src/main/cpp/Operator.cpp @@ -80,6 +80,7 @@ KInt Kotlin_Byte_unaryPlus (KByte a ) { return +a; } KInt Kotlin_Byte_unaryMinus (KByte a ) { return -a; } KByte Kotlin_Byte_toByte (KByte a ) { return a; } +KChar Kotlin_Byte_toChar (KByte a ) { return a; } KShort Kotlin_Byte_toShort (KByte a ) { return a; } KInt Kotlin_Byte_toInt (KByte a ) { return a; } KLong Kotlin_Byte_toLong (KByte a ) { return a; } @@ -136,6 +137,7 @@ KInt Kotlin_Short_unaryPlus (KShort a ) { return +a; } KInt Kotlin_Short_unaryMinus (KShort a ) { return -a; } KByte Kotlin_Short_toByte (KShort a ) { return a; } +KChar Kotlin_Short_toChar (KShort a ) { return a; } KShort Kotlin_Short_toShort (KShort a ) { return a; } KInt Kotlin_Short_toInt (KShort a ) { return a; } KLong Kotlin_Short_toLong (KShort a ) { return a; } @@ -268,6 +270,7 @@ KLong Kotlin_Long_ushr_Int (KLong a, KInt b) { } KByte Kotlin_Long_toByte (KLong a ) { return a; } +KChar Kotlin_Long_toChar (KLong a ) { return a; } KShort Kotlin_Long_toShort (KLong a ) { return a; } KInt Kotlin_Long_toInt (KLong a ) { return a; } KLong Kotlin_Long_toLong (KLong a ) { return a; } diff --git a/runtime/src/main/kotlin/kotlin/Primitives.kt b/runtime/src/main/kotlin/kotlin/Primitives.kt index c6021b88487..439470934ec 100644 --- a/runtime/src/main/kotlin/kotlin/Primitives.kt +++ b/runtime/src/main/kotlin/kotlin/Primitives.kt @@ -1091,8 +1091,7 @@ public final class Float : Number(), Comparable { @SymbolName("Kotlin_Float_toByte") external public override fun toByte(): Byte - @SymbolName("Kotlin_Float_toChar") - external public override fun toChar(): Char + public override fun toChar(): Char = this.toInt().toChar() @SymbolName("Kotlin_Float_toShort") external public override fun toShort(): Short @SymbolName("Kotlin_Float_toInt") @@ -1302,8 +1301,7 @@ public final class Double : Number(), Comparable { @SymbolName("Kotlin_Double_toByte") external public override fun toByte(): Byte - @SymbolName("Kotlin_Double_toChar") - external public override fun toChar(): Char + public override fun toChar(): Char = this.toInt().toChar() @SymbolName("Kotlin_Double_toShort") external public override fun toShort(): Short @SymbolName("Kotlin_Double_toInt")