[K/JS] Revert KT-60785 fix because the 1.9.0 contains old schema for functions inlining
This reverts commit b925404e11f82dd263b7a6bf924dc84cd579e8fc.
diff --git a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/JsLoweringPhases.kt b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/JsLoweringPhases.kt
index 88eb5b1..84ecf0f 100644
--- a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/JsLoweringPhases.kt
+++ b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/JsLoweringPhases.kt
@@ -727,7 +727,7 @@
)
private val autoboxingTransformerPhase = makeBodyLoweringPhase(
- { AutoboxingTransformer(it, shouldCalculateActualTypeForInlinedFunction = true) },
+ ::AutoboxingTransformer,
name = "AutoboxingTransformer",
description = "Insert box/unbox intrinsics"
)
diff --git a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/AutoboxingTransformer.kt b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/AutoboxingTransformer.kt
index dc236f7..55de84c 100644
--- a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/AutoboxingTransformer.kt
+++ b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/AutoboxingTransformer.kt
@@ -31,10 +31,7 @@
// Copied and adapted from Kotlin/Native
-abstract class AbstractValueUsageLowering(
- val context: JsCommonBackendContext,
- private val shouldCalculateActualTypeForInlinedFunction: Boolean = false
-) : AbstractValueUsageTransformer(context.irBuiltIns),
+abstract class AbstractValueUsageLowering(val context: JsCommonBackendContext) : AbstractValueUsageTransformer(context.irBuiltIns),
BodyLoweringPass {
val icUtils = context.inlineClassesUtils
@@ -55,19 +52,11 @@
abstract fun IrExpression.useExpressionAsType(actualType: IrType, expectedType: IrType): IrExpression
- protected fun IrExpression.getActualType(): IrType = when (this) {
+ protected fun IrExpression.getActualType() = when (this) {
is IrConstructorCall -> symbol.owner.returnType
is IrCall -> symbol.owner.realOverrideTarget.returnType
is IrGetField -> this.symbol.owner.type
- is IrInlinedFunctionBlock -> {
- if (shouldCalculateActualTypeForInlinedFunction) {
- inlineCall.getActualType()
- } else {
- this.type
- }
- }
-
is IrTypeOperatorCall -> {
if (operator == IrTypeOperator.REINTERPRET_CAST) {
this.typeOperand
@@ -131,10 +120,7 @@
)
}
-class AutoboxingTransformer(
- context: JsCommonBackendContext,
- shouldCalculateActualTypeForInlinedFunction: Boolean = false
-) : AbstractValueUsageLowering(context, shouldCalculateActualTypeForInlinedFunction) {
+class AutoboxingTransformer(context: JsCommonBackendContext) : AbstractValueUsageLowering(context) {
private var processingReturnStack = mutableListOf<IrReturn>()
private fun IrExpression.useReturnableExpressionAsType(expectedType: IrType): IrExpression {
diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/BoxJsTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/BoxJsTestGenerated.java
index 239bef2..a82c916 100644
--- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/BoxJsTestGenerated.java
+++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/BoxJsTestGenerated.java
@@ -797,12 +797,6 @@
}
@Test
- @TestMetadata("boxingUnboxingInsideTheSuspendFunction.kt")
- public void testBoxingUnboxingInsideTheSuspendFunction() throws Exception {
- runTest("js/js.translator/testData/box/coroutines/boxingUnboxingInsideTheSuspendFunction.kt");
- }
-
- @Test
@TestMetadata("debugStatement.kt")
public void testDebugStatement() throws Exception {
runTest("js/js.translator/testData/box/coroutines/debugStatement.kt");
diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsBoxTestGenerated.java
index 62ec9fb..ca05644 100644
--- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsBoxTestGenerated.java
+++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsBoxTestGenerated.java
@@ -861,12 +861,6 @@
}
@Test
- @TestMetadata("boxingUnboxingInsideTheSuspendFunction.kt")
- public void testBoxingUnboxingInsideTheSuspendFunction() throws Exception {
- runTest("js/js.translator/testData/box/coroutines/boxingUnboxingInsideTheSuspendFunction.kt");
- }
-
- @Test
@TestMetadata("debugStatement.kt")
public void testDebugStatement() throws Exception {
runTest("js/js.translator/testData/box/coroutines/debugStatement.kt");
diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrBoxJsES6TestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrBoxJsES6TestGenerated.java
index f38a26d..a8015be 100644
--- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrBoxJsES6TestGenerated.java
+++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrBoxJsES6TestGenerated.java
@@ -861,12 +861,6 @@
}
@Test
- @TestMetadata("boxingUnboxingInsideTheSuspendFunction.kt")
- public void testBoxingUnboxingInsideTheSuspendFunction() throws Exception {
- runTest("js/js.translator/testData/box/coroutines/boxingUnboxingInsideTheSuspendFunction.kt");
- }
-
- @Test
@TestMetadata("debugStatement.kt")
public void testDebugStatement() throws Exception {
runTest("js/js.translator/testData/box/coroutines/debugStatement.kt");
diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrBoxJsTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrBoxJsTestGenerated.java
index b3d1ea8..116c84b 100644
--- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrBoxJsTestGenerated.java
+++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrBoxJsTestGenerated.java
@@ -861,12 +861,6 @@
}
@Test
- @TestMetadata("boxingUnboxingInsideTheSuspendFunction.kt")
- public void testBoxingUnboxingInsideTheSuspendFunction() throws Exception {
- runTest("js/js.translator/testData/box/coroutines/boxingUnboxingInsideTheSuspendFunction.kt");
- }
-
- @Test
@TestMetadata("debugStatement.kt")
public void testDebugStatement() throws Exception {
runTest("js/js.translator/testData/box/coroutines/debugStatement.kt");
diff --git a/js/js.translator/testData/box/coroutines/boxingUnboxingInsideTheSuspendFunction.kt b/js/js.translator/testData/box/coroutines/boxingUnboxingInsideTheSuspendFunction.kt
deleted file mode 100644
index 0b12849..0000000
--- a/js/js.translator/testData/box/coroutines/boxingUnboxingInsideTheSuspendFunction.kt
+++ /dev/null
@@ -1,35 +0,0 @@
-// WITH_STDLIB
-// EXPECTED_REACHABLE_NODES: 1292
-// KT-60785
-
-import kotlin.coroutines.*
-import kotlin.coroutines.intrinsics.*
-
-value class SomeValue(val a: String) {
- override fun toString() = when (a) {
- "fa" -> "O"
- "il" -> "K"
- else -> ""
- }
-}
-
-suspend fun foo() = mapOf(SomeValue("fa") to SomeValue("il"))
-
-fun builder(c: suspend () -> Unit) {
- c.startCoroutine(object : Continuation<Unit> {
- override val context = EmptyCoroutineContext
- override fun resumeWith(result: Result<Unit>) {}
- })
-}
-
-fun box(): String {
- var result = ""
-
- builder {
- for ((k, v) in foo()) {
- result += "$k$v"
- }
- }
-
- return result
-}