[WASM] Remove workaround for frontend bug

This commit is contained in:
Igor Laevsky
2021-09-17 19:17:45 +03:00
parent 987a346015
commit e23b4df519
@@ -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(