Minor. Make test actually suspend and add a test without suspension

This commit is contained in:
Ilmir Usmanov
2021-04-22 13:26:27 +02:00
parent 23ffbe4d9e
commit f7a9bc3521
11 changed files with 128 additions and 7 deletions
@@ -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
@@ -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
}
@@ -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
}
@@ -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
}
@@ -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
}
@@ -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
@@ -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
@@ -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")
@@ -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")
@@ -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")
@@ -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")