JVM_IR: Box generic Result parameter in suspend lambda
#KT-44527 Fixed
This commit is contained in:
+6
@@ -9621,6 +9621,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/inlineClasses"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("genericParameterResult.kt")
|
||||
public void testGenericParameterResult() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/genericParameterResult.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("nonLocalReturn.kt")
|
||||
public void testNonLocalReturn() throws Exception {
|
||||
|
||||
+2
-1
@@ -39,7 +39,8 @@ abstract class PromisedValue(val codegen: ExpressionCodegen, val type: Type, val
|
||||
// Boxing and unboxing kotlin.Result leads to CCE in generated code
|
||||
val doNotCoerceKotlinResultInContinuation =
|
||||
(codegen.irFunction.parentAsClass.origin == JvmLoweredDeclarationOrigin.CONTINUATION_CLASS ||
|
||||
codegen.irFunction.parentAsClass.origin == JvmLoweredDeclarationOrigin.SUSPEND_LAMBDA)
|
||||
(codegen.irFunction.parentAsClass.origin == JvmLoweredDeclarationOrigin.SUSPEND_LAMBDA &&
|
||||
!codegen.irFunction.isInvokeSuspendOfLambda()))
|
||||
&& (irType.isKotlinResult() || irTarget.isKotlinResult())
|
||||
|
||||
// Coerce inline classes
|
||||
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
// WITH_RUNTIME
|
||||
// IGNORE_BACKEND: JS_IR
|
||||
|
||||
import kotlin.coroutines.*
|
||||
|
||||
fun box(): String {
|
||||
suspend {
|
||||
listOf(Result.success(true)).forEach {
|
||||
println(it.getOrNull())
|
||||
}
|
||||
}.startCoroutine(Continuation(EmptyCoroutineContext) {
|
||||
it.getOrThrow()
|
||||
})
|
||||
return "OK"
|
||||
}
|
||||
+6
@@ -9621,6 +9621,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/inlineClasses"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("genericParameterResult.kt")
|
||||
public void testGenericParameterResult() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/genericParameterResult.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("nonLocalReturn.kt")
|
||||
public void testNonLocalReturn() throws Exception {
|
||||
|
||||
+6
@@ -9621,6 +9621,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/inlineClasses"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("genericParameterResult.kt")
|
||||
public void testGenericParameterResult() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/genericParameterResult.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("nonLocalReturn.kt")
|
||||
public void testNonLocalReturn() throws Exception {
|
||||
|
||||
+5
@@ -7637,6 +7637,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/inlineClasses"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
|
||||
}
|
||||
|
||||
@TestMetadata("genericParameterResult.kt")
|
||||
public void testGenericParameterResult() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/genericParameterResult.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("nonLocalReturn.kt")
|
||||
public void testNonLocalReturn() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/nonLocalReturn.kt");
|
||||
|
||||
js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java
Generated
+5
@@ -6872,6 +6872,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/inlineClasses"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true);
|
||||
}
|
||||
|
||||
@TestMetadata("genericParameterResult.kt")
|
||||
public void testGenericParameterResult() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/genericParameterResult.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("nonLocalReturn.kt")
|
||||
public void testNonLocalReturn() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/nonLocalReturn.kt");
|
||||
|
||||
Generated
+5
@@ -6357,6 +6357,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/inlineClasses"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true);
|
||||
}
|
||||
|
||||
@TestMetadata("genericParameterResult.kt")
|
||||
public void testGenericParameterResult() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/genericParameterResult.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("nonLocalReturn.kt")
|
||||
public void testNonLocalReturn() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/nonLocalReturn.kt");
|
||||
|
||||
Generated
+5
@@ -6357,6 +6357,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/inlineClasses"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true);
|
||||
}
|
||||
|
||||
@TestMetadata("genericParameterResult.kt")
|
||||
public void testGenericParameterResult() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/genericParameterResult.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("nonLocalReturn.kt")
|
||||
public void testNonLocalReturn() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/nonLocalReturn.kt");
|
||||
|
||||
Reference in New Issue
Block a user