[FIR] Add tests for K2-only suspend operators get/set/contains
#KT-57169
This commit is contained in:
committed by
Space Team
parent
ca022cf4dc
commit
793e3552e7
+6
@@ -34945,6 +34945,12 @@ public class FirLightTreeBlackBoxCodegenTestGenerated extends AbstractFirLightTr
|
||||
runTest("compiler/testData/codegen/box/operatorConventions/remOverModOperation.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("suspendOperators.kt")
|
||||
public void testSuspendOperators() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/operatorConventions/suspendOperators.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("untilOperator.kt")
|
||||
public void testUntilOperator() throws Exception {
|
||||
|
||||
+6
@@ -34945,6 +34945,12 @@ public class FirPsiBlackBoxCodegenTestGenerated extends AbstractFirPsiBlackBoxCo
|
||||
runTest("compiler/testData/codegen/box/operatorConventions/remOverModOperation.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("suspendOperators.kt")
|
||||
public void testSuspendOperators() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/operatorConventions/suspendOperators.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("untilOperator.kt")
|
||||
public void testUntilOperator() throws Exception {
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
// WITH_STDLIB
|
||||
// WITH_COROUTINES
|
||||
// IGNORE_BACKEND_K1: ANY
|
||||
// IGNORE_BACKEND: WASM
|
||||
|
||||
import kotlin.coroutines.*
|
||||
import kotlin.coroutines.intrinsics.*
|
||||
|
||||
fun <T> runBlocking(c: suspend () -> T): T {
|
||||
var res: T? = null
|
||||
c.startCoroutine(Continuation(EmptyCoroutineContext) {
|
||||
res = it.getOrThrow()
|
||||
})
|
||||
return res!!
|
||||
}
|
||||
|
||||
class A {
|
||||
var value = ""
|
||||
|
||||
suspend operator fun get(x: Int) = value
|
||||
suspend operator fun set(x: Int, v: String) {
|
||||
value = v
|
||||
}
|
||||
|
||||
operator suspend fun contains(y: String): Boolean = y == value
|
||||
}
|
||||
|
||||
fun box() = runBlocking {
|
||||
val a = A()
|
||||
if ("" !in a) return@runBlocking "FAIL"
|
||||
a[1] = "OK"
|
||||
|
||||
a[2]
|
||||
}
|
||||
+6
@@ -33361,6 +33361,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
runTest("compiler/testData/codegen/box/operatorConventions/remOverModOperation.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("suspendOperators.kt")
|
||||
public void testSuspendOperators() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/operatorConventions/suspendOperators.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("untilOperator.kt")
|
||||
public void testUntilOperator() throws Exception {
|
||||
|
||||
+6
@@ -34945,6 +34945,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
runTest("compiler/testData/codegen/box/operatorConventions/remOverModOperation.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("suspendOperators.kt")
|
||||
public void testSuspendOperators() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/operatorConventions/suspendOperators.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("untilOperator.kt")
|
||||
public void testUntilOperator() throws Exception {
|
||||
|
||||
+6
@@ -34945,6 +34945,12 @@ public class IrBlackBoxCodegenWithIrInlinerTestGenerated extends AbstractIrBlack
|
||||
runTest("compiler/testData/codegen/box/operatorConventions/remOverModOperation.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("suspendOperators.kt")
|
||||
public void testSuspendOperators() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/operatorConventions/suspendOperators.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("untilOperator.kt")
|
||||
public void testUntilOperator() throws Exception {
|
||||
|
||||
+5
@@ -28479,6 +28479,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
||||
runTest("compiler/testData/codegen/box/operatorConventions/remOverModOperation.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("suspendOperators.kt")
|
||||
public void testSuspendOperators() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/operatorConventions/suspendOperators.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("untilOperator.kt")
|
||||
public void testUntilOperator() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/operatorConventions/untilOperator.kt");
|
||||
|
||||
Reference in New Issue
Block a user