[K/N] Add test for inter-module suspend function override
This commit is contained in:
committed by
Space Team
parent
132bb941e1
commit
2d4c94a115
+6
@@ -12638,6 +12638,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
|||||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/multiModule"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/multiModule"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("inheritFromAnotherModule.kt")
|
||||||
|
public void testInheritFromAnotherModule() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/coroutines/multiModule/inheritFromAnotherModule.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("inlineCrossModule.kt")
|
@TestMetadata("inlineCrossModule.kt")
|
||||||
public void testInlineCrossModule() throws Exception {
|
public void testInlineCrossModule() throws Exception {
|
||||||
|
|||||||
+49
@@ -0,0 +1,49 @@
|
|||||||
|
// WITH_STDLIB
|
||||||
|
// WITH_COROUTINES
|
||||||
|
|
||||||
|
// MODULE: lib
|
||||||
|
// FILE: lib.kt
|
||||||
|
|
||||||
|
class AAA
|
||||||
|
class ZZZ
|
||||||
|
|
||||||
|
open class A {
|
||||||
|
// function signatures are chosen in a way, that their order for Native will change, if suspend is not lowered correctly
|
||||||
|
open suspend fun f(x:Int) = 1
|
||||||
|
open fun f(x:AAA) = 2
|
||||||
|
open fun f(x:ZZZ) = 3
|
||||||
|
}
|
||||||
|
|
||||||
|
// MODULE: main(lib)
|
||||||
|
// FILE: main.kt
|
||||||
|
|
||||||
|
import kotlin.coroutines.*
|
||||||
|
import helpers.*
|
||||||
|
|
||||||
|
|
||||||
|
class ImplementA : A(){
|
||||||
|
override suspend fun f(x:Int) = 4
|
||||||
|
}
|
||||||
|
|
||||||
|
class NotImplementA : A() {}
|
||||||
|
|
||||||
|
|
||||||
|
fun runF(x: A, f: suspend A.() -> Int) : Int {
|
||||||
|
var res: Int = -1
|
||||||
|
f.startCoroutine(x, handleResultContinuation {
|
||||||
|
res = it
|
||||||
|
})
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
|
||||||
|
fun box() : String {
|
||||||
|
val x = if (true) ImplementA() else A() // to avoid devirtualization
|
||||||
|
if (x.f(AAA()) != 2) return "FAIL 1"
|
||||||
|
if (x.f(ZZZ()) != 3) return "FAIL 2"
|
||||||
|
if (runF(x, { f(1) }) != 4) return "FAIL 3"
|
||||||
|
val y = if (true) NotImplementA() else A() // to avoid devirtualization
|
||||||
|
if (y.f(AAA()) != 2) return "FAIL 4"
|
||||||
|
if (y.f(ZZZ()) != 3) return "FAIL 5"
|
||||||
|
if (runF(y, { f(1) }) != 1) return "FAIL 6"
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
+6
@@ -12464,6 +12464,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
|||||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/multiModule"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
|
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/multiModule"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("inheritFromAnotherModule.kt")
|
||||||
|
public void testInheritFromAnotherModule() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/coroutines/multiModule/inheritFromAnotherModule.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("inlineCrossModule.kt")
|
@TestMetadata("inlineCrossModule.kt")
|
||||||
public void testInlineCrossModule() throws Exception {
|
public void testInlineCrossModule() throws Exception {
|
||||||
|
|||||||
+6
@@ -12638,6 +12638,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
|||||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/multiModule"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/multiModule"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("inheritFromAnotherModule.kt")
|
||||||
|
public void testInheritFromAnotherModule() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/coroutines/multiModule/inheritFromAnotherModule.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("inlineCrossModule.kt")
|
@TestMetadata("inlineCrossModule.kt")
|
||||||
public void testInlineCrossModule() throws Exception {
|
public void testInlineCrossModule() throws Exception {
|
||||||
|
|||||||
+5
@@ -10010,6 +10010,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
|||||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/multiModule"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
|
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/multiModule"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("inheritFromAnotherModule.kt")
|
||||||
|
public void testInheritFromAnotherModule() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/coroutines/multiModule/inheritFromAnotherModule.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("inlineCrossModule.kt")
|
@TestMetadata("inlineCrossModule.kt")
|
||||||
public void testInlineCrossModule() throws Exception {
|
public void testInlineCrossModule() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/coroutines/multiModule/inlineCrossModule.kt");
|
runTest("compiler/testData/codegen/box/coroutines/multiModule/inlineCrossModule.kt");
|
||||||
|
|||||||
+6
@@ -9268,6 +9268,12 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
|||||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/multiModule"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true);
|
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/multiModule"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("inheritFromAnotherModule.kt")
|
||||||
|
public void testInheritFromAnotherModule() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/coroutines/multiModule/inheritFromAnotherModule.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("inlineCrossModule.kt")
|
@TestMetadata("inlineCrossModule.kt")
|
||||||
public void testInlineCrossModule() throws Exception {
|
public void testInlineCrossModule() throws Exception {
|
||||||
|
|||||||
+6
@@ -9358,6 +9358,12 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
|
|||||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/multiModule"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true);
|
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/multiModule"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("inheritFromAnotherModule.kt")
|
||||||
|
public void testInheritFromAnotherModule() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/coroutines/multiModule/inheritFromAnotherModule.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("inlineCrossModule.kt")
|
@TestMetadata("inlineCrossModule.kt")
|
||||||
public void testInlineCrossModule() throws Exception {
|
public void testInlineCrossModule() throws Exception {
|
||||||
|
|||||||
+5
@@ -8245,6 +8245,11 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest
|
|||||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/multiModule"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.WASM, true);
|
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/multiModule"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.WASM, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("inheritFromAnotherModule.kt")
|
||||||
|
public void testInheritFromAnotherModule() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/coroutines/multiModule/inheritFromAnotherModule.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("inlineCrossModule.kt")
|
@TestMetadata("inlineCrossModule.kt")
|
||||||
public void testInlineCrossModule() throws Exception {
|
public void testInlineCrossModule() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/coroutines/multiModule/inlineCrossModule.kt");
|
runTest("compiler/testData/codegen/box/coroutines/multiModule/inlineCrossModule.kt");
|
||||||
|
|||||||
+6
@@ -10266,6 +10266,12 @@ public class NativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTest
|
|||||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/multiModule"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true);
|
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/coroutines/multiModule"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("inheritFromAnotherModule.kt")
|
||||||
|
public void testInheritFromAnotherModule() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/coroutines/multiModule/inheritFromAnotherModule.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("inlineCrossModule.kt")
|
@TestMetadata("inlineCrossModule.kt")
|
||||||
public void testInlineCrossModule() throws Exception {
|
public void testInlineCrossModule() throws Exception {
|
||||||
|
|||||||
Reference in New Issue
Block a user