[tests] Added a test for KT-55494

This commit is contained in:
Igor Chevdar
2022-12-15 19:25:24 +02:00
committed by Space Team
parent 1e1f96f73e
commit 0f2ebeea15
10 changed files with 98 additions and 0 deletions
@@ -10489,6 +10489,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
runTest("compiler/testData/codegen/box/coroutines/kt52561.kt");
}
@Test
@TestMetadata("kt55494.kt")
public void testKt55494() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/kt55494.kt");
}
@Test
@TestMetadata("lastExpressionIsLoop.kt")
public void testLastExpressionIsLoop() throws Exception {
+46
View File
@@ -0,0 +1,46 @@
// WITH_STDLIB
// WITH_COROUTINES
// FILE: t1.kt
import kotlin.coroutines.intrinsics.COROUTINE_SUSPENDED
import kotlin.coroutines.intrinsics.suspendCoroutineUninterceptedOrReturn
import kotlin.coroutines.*
private suspend fun suspendHere(): Int = suspendCoroutineUninterceptedOrReturn { x ->
x.resume(42)
COROUTINE_SUSPENDED
}
suspend fun foo() = suspendHere() + suspendHere()
// FILE: t2.kt
import kotlin.coroutines.intrinsics.COROUTINE_SUSPENDED
import kotlin.coroutines.intrinsics.suspendCoroutineUninterceptedOrReturn
import kotlin.coroutines.*
private suspend fun suspendHere(): Int = suspendCoroutineUninterceptedOrReturn { x ->
x.resume(42)
COROUTINE_SUSPENDED
}
suspend fun foo(x: Int) = suspendHere() - x
// FILE: main.kt
import helpers.*
import kotlin.coroutines.*
fun builder(c: suspend () -> Unit) {
c.startCoroutine(EmptyContinuation)
}
fun box(): String {
var result = 0
builder {
result += foo()
result += foo(9)
}
return if (result == 117) "OK" else "fail"
}
@@ -10285,6 +10285,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
runTest("compiler/testData/codegen/box/coroutines/kt52561.kt");
}
@Test
@TestMetadata("kt55494.kt")
public void testKt55494() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/kt55494.kt");
}
@Test
@TestMetadata("lastExpressionIsLoop.kt")
public void testLastExpressionIsLoop() throws Exception {
@@ -10489,6 +10489,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
runTest("compiler/testData/codegen/box/coroutines/kt52561.kt");
}
@Test
@TestMetadata("kt55494.kt")
public void testKt55494() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/kt55494.kt");
}
@Test
@TestMetadata("lastExpressionIsLoop.kt")
public void testLastExpressionIsLoop() throws Exception {
@@ -8092,6 +8092,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
runTest("compiler/testData/codegen/box/coroutines/kt52561.kt");
}
@TestMetadata("kt55494.kt")
public void testKt55494() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/kt55494.kt");
}
@TestMetadata("lastExpressionIsLoop.kt")
public void testLastExpressionIsLoop() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/lastExpressionIsLoop.kt");