JVM_IR: fix suspendCoroutineUninterceptedOrReturn
This commit is contained in:
+4
-1
@@ -485,7 +485,10 @@ class ExpressionCodegen(
|
||||
!symbol.owner.isSuspend || !irFunction.shouldContainSuspendMarkers() -> false
|
||||
// Copy-pasted bytecode blocks are not suspension points.
|
||||
symbol.owner.isInline ->
|
||||
symbol.owner.fqNameForIrSerialization == FqName("kotlin.coroutines.intrinsics.IntrinsicsKt.suspendCoroutineUninterceptedOrReturn")
|
||||
symbol.owner.let {
|
||||
it.name.asString() == "suspendCoroutineUninterceptedOrReturn" &&
|
||||
it.getPackageFragment()?.fqName == FqName("kotlin.coroutines.intrinsics")
|
||||
}
|
||||
// This includes inline lambdas, but only in functions intended for the inliner; in others, they stay as `f.invoke()`.
|
||||
dispatchReceiver.isReadOfInlineLambda() ->
|
||||
irFunction.origin != FOR_INLINE_STATE_MACHINE_TEMPLATE && irFunction.origin != FOR_INLINE_STATE_MACHINE_TEMPLATE_CAPTURES_CROSSINLINE &&
|
||||
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
// FILE: Intrinsics.kt
|
||||
@file:kotlin.jvm.JvmName("IntrinsicsKt")
|
||||
@file:kotlin.jvm.JvmMultifileClass
|
||||
|
||||
package kotlin.coroutines.intrinsics
|
||||
|
||||
import kotlin.coroutines.*
|
||||
import kotlin.internal.InlineOnly
|
||||
|
||||
@InlineOnly
|
||||
@Suppress("UNUSED_PARAMETER", "RedundantSuspendModifier")
|
||||
public suspend inline fun <T> suspendCoroutineUninterceptedOrReturn(crossinline block: (Continuation<T>) -> Any?): T =
|
||||
throw NotImplementedError("Implementation of suspendCoroutineUninterceptedOrReturn is intrinsic")
|
||||
|
||||
// FILE: Annotations.kt
|
||||
package kotlin.internal
|
||||
|
||||
@Target(AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER)
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
internal annotation class InlineOnly
|
||||
|
||||
// FILE: test.kt
|
||||
package kotlin.coroutines
|
||||
|
||||
import kotlin.coroutines.intrinsics.*
|
||||
import kotlin.internal.InlineOnly
|
||||
|
||||
@InlineOnly
|
||||
public suspend inline fun <T> suspendTest(crossinline block: (Continuation<T>) -> Unit): T =
|
||||
suspendCoroutineUninterceptedOrReturn { c: Continuation<T> -> }
|
||||
|
||||
// @kotlin/coroutines/TestKt.class:
|
||||
// 2 InlineMarker.mark
|
||||
@@ -399,6 +399,11 @@ public class BytecodeTextTestGenerated extends AbstractBytecodeTextTest {
|
||||
runTest("compiler/testData/codegen/bytecodeText/superFlagInMultiFileFacade.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("suspendCoroutineUninterceptedOrReturn.kt")
|
||||
public void testSuspendCoroutineUninterceptedOrReturn() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeText/suspendCoroutineUninterceptedOrReturn.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("topLevelFunWithDefaultArgs.kt")
|
||||
public void testTopLevelFunWithDefaultArgs() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeText/topLevelFunWithDefaultArgs.kt");
|
||||
|
||||
+5
@@ -399,6 +399,11 @@ public class IrBytecodeTextTestGenerated extends AbstractIrBytecodeTextTest {
|
||||
runTest("compiler/testData/codegen/bytecodeText/superFlagInMultiFileFacade.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("suspendCoroutineUninterceptedOrReturn.kt")
|
||||
public void testSuspendCoroutineUninterceptedOrReturn() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeText/suspendCoroutineUninterceptedOrReturn.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("topLevelFunWithDefaultArgs.kt")
|
||||
public void testTopLevelFunWithDefaultArgs() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeText/topLevelFunWithDefaultArgs.kt");
|
||||
|
||||
Reference in New Issue
Block a user