From e23b4df519e4ec2ffcff7aefc3adf4d54d9174a9 Mon Sep 17 00:00:00 2001 From: Igor Laevsky Date: Fri, 17 Sep 2021 19:17:45 +0300 Subject: [PATCH] [WASM] Remove workaround for frontend bug --- .../wasm/lower/WasmTypeOperatorLowering.kt | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/lower/WasmTypeOperatorLowering.kt b/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/lower/WasmTypeOperatorLowering.kt index 272e4ab7159..5868fa1d304 100644 --- a/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/lower/WasmTypeOperatorLowering.kt +++ b/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/lower/WasmTypeOperatorLowering.kt @@ -168,22 +168,6 @@ class WasmBaseTypeOperatorTransformer(val context: WasmBackendContext) : IrEleme } } - // Workaround for the bug in frontend. - // In code like this: - // val p: Int = try { - // 1 - // } catch (e: Exception) { - // throw RuntimeException() - // } - // Frontend will emit IMPLICIT_CAST from Unit into Int. Such code can't be correctly compiled to wasm as it is. - // This supposed to only happen in the unreachable code so we emit unreachable intrinsic. - if (fromType == builtIns.unitType && toType !in listOf(builtIns.unitType, builtIns.anyType, builtIns.anyNType)) { - return builder.irComposite(resultType = toType) { - +value - +builder.irCall(symbols.wasmUnreachable) - } - } - // Handled by autoboxing transformer if (toType.isInlined() && !fromType.isInlined()) { return builder.irCall(