[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");
|
||||
|
||||
+6
@@ -24625,6 +24625,12 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
||||
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
@@ -24829,6 +24829,12 @@ public class FirJsCodegenBoxTestGenerated extends AbstractFirJsCodegenBoxTest {
|
||||
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
@@ -24829,6 +24829,12 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
|
||||
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
@@ -24829,6 +24829,12 @@ public class IrJsES6CodegenBoxTestGenerated extends AbstractIrJsES6CodegenBoxTes
|
||||
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
@@ -27961,6 +27961,12 @@ public class FirNativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTe
|
||||
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
@@ -28595,6 +28595,12 @@ public class FirNativeCodegenBoxTestNoPLGenerated extends AbstractNativeCodegenB
|
||||
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
@@ -27645,6 +27645,12 @@ public class NativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTest
|
||||
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
@@ -27962,6 +27962,12 @@ public class NativeCodegenBoxTestNoPLGenerated extends AbstractNativeCodegenBoxT
|
||||
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 {
|
||||
|
||||
Generated
+5
@@ -22062,6 +22062,11 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest
|
||||
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