[JS IR BE] Support Long coercion

This commit is contained in:
Svyatoslav Kuzmich
2018-10-02 19:02:39 +03:00
parent c7bde6a5e6
commit 749556f565
5 changed files with 3 additions and 5 deletions
@@ -317,7 +317,9 @@ class TypeOperatorLowering(val context: JsIrBackendContext) : FileLoweringPass {
val casted = when {
toType.isByte() -> maskOp(argument, byteMask, lit24)
toType.isShort() -> maskOp(argument, shortMask, lit16)
toType.isLong() -> TODO("Long coercion")
toType.isLong() -> JsIrBuilder.buildCall(context.intrinsics.jsToLong).apply {
putValueArgument(0, argument)
}
else -> error("Unreachable execution (coercion to non-Integer type")
}
-1
View File
@@ -1,4 +1,3 @@
// IGNORE_BACKEND: JS_IR
fun box(): String {
val a1: Byte = 1.plus(1)
val a2: Short = 1.plus(1)
@@ -1,4 +1,3 @@
// IGNORE_BACKEND: JS_IR
fun box(): String {
val a1: Byte? = 1.plus(1)
val a2: Short? = 1.plus(1)
-1
View File
@@ -1,4 +1,3 @@
// IGNORE_BACKEND: JS_IR
fun box(): String {
val a1: Byte = 1 + 1
val a2: Short = 1 + 1
@@ -1,4 +1,3 @@
// IGNORE_BACKEND: JS_IR
fun box(): String {
val a1: Byte? = 1 + 1
val a2: Short? = 1 + 1