Minor. Make test actually suspend and add a test without suspension
This commit is contained in:
+12
@@ -10328,6 +10328,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
||||
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/invokeOperator.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("multifileBridge.kt")
|
||||
public void testMultifileBridge() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/multifileBridge.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("overrideSuspendFun.kt")
|
||||
public void testOverrideSuspendFun() throws Exception {
|
||||
@@ -10363,6 +10369,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
||||
public void testReturnResult() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/returnResult.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("syntheticAccessor.kt")
|
||||
public void testSyntheticAccessor() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/syntheticAccessor.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// WITH_RUNTIME
|
||||
// WITH_COROUTINES
|
||||
// FILE: a.kt
|
||||
@file:JvmMultifileClass
|
||||
@file:JvmName("A")
|
||||
|
||||
import kotlin.coroutines.*
|
||||
import kotlin.coroutines.intrinsics.*
|
||||
|
||||
@Suppress("UNSUPPORTED_FEATURE")
|
||||
inline class I(val x: Any?)
|
||||
|
||||
suspend fun <T> suspendHere(t: T): T = t
|
||||
|
||||
suspend fun f(): I = I(suspendHere("OK"))
|
||||
|
||||
// FILE: z.kt
|
||||
import helpers.*
|
||||
import kotlin.coroutines.*
|
||||
|
||||
fun box(): String {
|
||||
var result = "fail"
|
||||
suspend { result = f().x as String }.startCoroutine(EmptyContinuation)
|
||||
return result
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
// WITH_RUNTIME
|
||||
// WITH_COROUTINES
|
||||
// IGNORE_BACKEND: JS_IR
|
||||
|
||||
import helpers.*
|
||||
import kotlin.coroutines.*
|
||||
import kotlin.coroutines.intrinsics.*
|
||||
|
||||
@Suppress("UNSUPPORTED_FEATURE")
|
||||
inline class I(val x: Any?)
|
||||
|
||||
class C {
|
||||
private suspend fun f(): I {
|
||||
return I("OK")
|
||||
}
|
||||
|
||||
fun g() = suspend { f() }
|
||||
}
|
||||
|
||||
val c: Continuation<Unit>? = null
|
||||
|
||||
fun box(): String {
|
||||
var result = "fail"
|
||||
suspend { result = C().g()().x as String }.startCoroutine(EmptyContinuation)
|
||||
|
||||
return result
|
||||
}
|
||||
+7
-4
@@ -1,4 +1,4 @@
|
||||
// TARGET_PLATFORM: JVM
|
||||
// TARGET_BACKEND: JVM
|
||||
// WITH_RUNTIME
|
||||
// WITH_COROUTINES
|
||||
// FILE: a.kt
|
||||
@@ -11,12 +11,14 @@ import kotlin.coroutines.intrinsics.*
|
||||
@Suppress("UNSUPPORTED_FEATURE")
|
||||
inline class I(val x: Any?)
|
||||
|
||||
suspend fun <T> suspendHere(x: T): T = suspendCoroutineUninterceptedOrReturn {
|
||||
it.resume(x)
|
||||
suspend fun <T> suspendHere(): T = suspendCoroutineUninterceptedOrReturn {
|
||||
c = it as Continuation<Any?>
|
||||
COROUTINE_SUSPENDED
|
||||
}
|
||||
|
||||
suspend fun f(): I = I(suspendHere("OK"))
|
||||
var c: Continuation<Any?>? = null
|
||||
|
||||
suspend fun f(): I = I(suspendHere<String>())
|
||||
|
||||
// FILE: z.kt
|
||||
import helpers.*
|
||||
@@ -25,5 +27,6 @@ import kotlin.coroutines.*
|
||||
fun box(): String {
|
||||
var result = "fail"
|
||||
suspend { result = f().x as String }.startCoroutine(EmptyContinuation)
|
||||
c?.resume("OK")
|
||||
return result
|
||||
}
|
||||
|
||||
+7
-3
@@ -8,13 +8,15 @@ import kotlin.coroutines.intrinsics.*
|
||||
@Suppress("UNSUPPORTED_FEATURE")
|
||||
inline class I(val x: Any?)
|
||||
|
||||
suspend fun <T> suspendHere(x: T): T = suspendCoroutineUninterceptedOrReturn {
|
||||
it.resume(x)
|
||||
suspend fun <T> suspendHere(): T = suspendCoroutineUninterceptedOrReturn {
|
||||
c = it as Continuation<Any?>
|
||||
COROUTINE_SUSPENDED
|
||||
}
|
||||
|
||||
var c: Continuation<Any?>? = null
|
||||
|
||||
class C {
|
||||
private suspend fun f(): I = I(suspendHere("OK"))
|
||||
private suspend fun f(): I = I(suspendHere<String>())
|
||||
|
||||
fun g() = suspend { f() }
|
||||
}
|
||||
@@ -22,5 +24,7 @@ class C {
|
||||
fun box(): String {
|
||||
var result = "fail"
|
||||
suspend { result = C().g()().x as String }.startCoroutine(EmptyContinuation)
|
||||
|
||||
c?.resume("OK")
|
||||
return result
|
||||
}
|
||||
|
||||
+12
@@ -10328,6 +10328,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/invokeOperator.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("multifileBridge.kt")
|
||||
public void testMultifileBridge() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/multifileBridge.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("overrideSuspendFun.kt")
|
||||
public void testOverrideSuspendFun() throws Exception {
|
||||
@@ -10363,6 +10369,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
public void testReturnResult() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/returnResult.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("syntheticAccessor.kt")
|
||||
public void testSyntheticAccessor() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/syntheticAccessor.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
|
||||
+12
@@ -10328,6 +10328,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/invokeOperator.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("multifileBridge.kt")
|
||||
public void testMultifileBridge() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/multifileBridge.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("overrideSuspendFun.kt")
|
||||
public void testOverrideSuspendFun() throws Exception {
|
||||
@@ -10363,6 +10369,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
public void testReturnResult() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/returnResult.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("syntheticAccessor.kt")
|
||||
public void testSyntheticAccessor() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/syntheticAccessor.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
|
||||
+10
@@ -8181,6 +8181,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
||||
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/invokeOperator.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("multifileBridge.kt")
|
||||
public void testMultifileBridge() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/multifileBridge.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("overrideSuspendFun.kt")
|
||||
public void testOverrideSuspendFun() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/overrideSuspendFun.kt");
|
||||
@@ -8210,6 +8215,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
||||
public void testReturnResult() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/returnResult.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("syntheticAccessor.kt")
|
||||
public void testSyntheticAccessor() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/syntheticAccessor.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/coroutines/inlineClasses/resume")
|
||||
|
||||
js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java
Generated
+5
@@ -7354,6 +7354,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes
|
||||
public void testReturnResult() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/returnResult.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("syntheticAccessor.kt")
|
||||
public void testSyntheticAccessor() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/syntheticAccessor.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/coroutines/inlineClasses/resume")
|
||||
|
||||
Generated
+5
@@ -6765,6 +6765,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
|
||||
public void testReturnResult() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/returnResult.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("syntheticAccessor.kt")
|
||||
public void testSyntheticAccessor() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/syntheticAccessor.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/coroutines/inlineClasses/resume")
|
||||
|
||||
Generated
+5
@@ -6765,6 +6765,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
||||
public void testReturnResult() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/returnResult.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("syntheticAccessor.kt")
|
||||
public void testSyntheticAccessor() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/coroutines/inlineClasses/direct/syntheticAccessor.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/coroutines/inlineClasses/resume")
|
||||
|
||||
Reference in New Issue
Block a user