diff --git a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/TypeOperatorLowering.kt b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/TypeOperatorLowering.kt index f9f623305ba..2b36821c187 100644 --- a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/TypeOperatorLowering.kt +++ b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/TypeOperatorLowering.kt @@ -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") } diff --git a/compiler/testData/codegen/box/binaryOp/call.kt b/compiler/testData/codegen/box/binaryOp/call.kt index 3831312a004..0f3d0139001 100644 --- a/compiler/testData/codegen/box/binaryOp/call.kt +++ b/compiler/testData/codegen/box/binaryOp/call.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR fun box(): String { val a1: Byte = 1.plus(1) val a2: Short = 1.plus(1) diff --git a/compiler/testData/codegen/box/binaryOp/callNullable.kt b/compiler/testData/codegen/box/binaryOp/callNullable.kt index 61f544cba27..0167a38ed04 100644 --- a/compiler/testData/codegen/box/binaryOp/callNullable.kt +++ b/compiler/testData/codegen/box/binaryOp/callNullable.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR fun box(): String { val a1: Byte? = 1.plus(1) val a2: Short? = 1.plus(1) diff --git a/compiler/testData/codegen/box/binaryOp/intrinsic.kt b/compiler/testData/codegen/box/binaryOp/intrinsic.kt index 6701f53d554..7434a7848e5 100644 --- a/compiler/testData/codegen/box/binaryOp/intrinsic.kt +++ b/compiler/testData/codegen/box/binaryOp/intrinsic.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR fun box(): String { val a1: Byte = 1 + 1 val a2: Short = 1 + 1 diff --git a/compiler/testData/codegen/box/binaryOp/intrinsicNullable.kt b/compiler/testData/codegen/box/binaryOp/intrinsicNullable.kt index 7ce75ab7579..fdfc98f3bb4 100644 --- a/compiler/testData/codegen/box/binaryOp/intrinsicNullable.kt +++ b/compiler/testData/codegen/box/binaryOp/intrinsicNullable.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR fun box(): String { val a1: Byte? = 1 + 1 val a2: Short? = 1 + 1