JVM_IR: Minor. Add test for SMAP of inner object/lambda of inline suspend function
This commit is contained in:
@@ -0,0 +1,146 @@
|
||||
// IGNORE_BACKEND_MULTI_MODULE: JVM_IR
|
||||
// WITH_RUNTIME
|
||||
// FILE: 1.kt
|
||||
|
||||
package test
|
||||
|
||||
interface SuspendRunnable {
|
||||
suspend fun run()
|
||||
}
|
||||
|
||||
inline suspend fun inlineMe1(crossinline c: suspend () -> Unit): SuspendRunnable =
|
||||
object : SuspendRunnable {
|
||||
override suspend fun run() {
|
||||
c()
|
||||
}
|
||||
}
|
||||
|
||||
inline suspend fun inlineMe2(crossinline c: suspend () -> Unit): suspend () -> Unit =
|
||||
{
|
||||
c()
|
||||
}
|
||||
|
||||
// FILE: 2.kt
|
||||
|
||||
import kotlin.coroutines.*
|
||||
import kotlin.coroutines.intrinsics.*
|
||||
import test.*
|
||||
|
||||
fun builder(c: suspend () -> Unit) {
|
||||
c.startCoroutine(object: Continuation<Unit> {
|
||||
override val context = EmptyCoroutineContext
|
||||
override fun resumeWith(result: Result<Unit>) {
|
||||
result.getOrThrow()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
var res = ""
|
||||
builder {
|
||||
inlineMe1 {
|
||||
res += "O"
|
||||
}.run()
|
||||
inlineMe2 {
|
||||
res += "K"
|
||||
}()
|
||||
}
|
||||
return res
|
||||
}
|
||||
|
||||
// FILE: 1.smap
|
||||
SMAP
|
||||
1.kt
|
||||
Kotlin
|
||||
*S Kotlin
|
||||
*F
|
||||
+ 1 1.kt
|
||||
test/_1Kt$inlineMe2$2
|
||||
*L
|
||||
1#1,23:1
|
||||
*E
|
||||
|
||||
SMAP
|
||||
1.kt
|
||||
Kotlin
|
||||
*S Kotlin
|
||||
*F
|
||||
+ 1 1.kt
|
||||
test/_1Kt$inlineMe1$2
|
||||
*L
|
||||
1#1,23:1
|
||||
*E
|
||||
|
||||
SMAP
|
||||
1.kt
|
||||
Kotlin
|
||||
*S Kotlin
|
||||
*F
|
||||
+ 1 1.kt
|
||||
test/_1Kt$inlineMe1$2$run$1
|
||||
*L
|
||||
1#1,23:1
|
||||
*E
|
||||
|
||||
// FILE: 2.smap
|
||||
SMAP
|
||||
2.kt
|
||||
Kotlin
|
||||
*S Kotlin
|
||||
*F
|
||||
+ 1 2.kt
|
||||
_2Kt$builder$1
|
||||
*L
|
||||
1#1,29:1
|
||||
*E
|
||||
|
||||
SMAP
|
||||
2.kt
|
||||
Kotlin
|
||||
*S Kotlin
|
||||
*F
|
||||
+ 1 2.kt
|
||||
_2Kt$box$1
|
||||
+ 2 1.kt
|
||||
test/_1Kt
|
||||
*L
|
||||
1#1,29:1
|
||||
12#2,5:30
|
||||
19#2,3:35
|
||||
*E
|
||||
*S KotlinDebug
|
||||
*F
|
||||
+ 1 2.kt
|
||||
_2Kt$box$1
|
||||
*L
|
||||
19#1,5:30
|
||||
22#1,3:35
|
||||
*E
|
||||
|
||||
SMAP
|
||||
1.kt
|
||||
Kotlin
|
||||
*S Kotlin
|
||||
*F
|
||||
+ 1 1.kt
|
||||
test/_1Kt$inlineMe2$2
|
||||
+ 2 2.kt
|
||||
_2Kt$box$1
|
||||
*L
|
||||
1#1,23:1
|
||||
23#2,2:24
|
||||
*E
|
||||
|
||||
SMAP
|
||||
1.kt
|
||||
Kotlin
|
||||
*S Kotlin
|
||||
*F
|
||||
+ 1 1.kt
|
||||
test/_1Kt$inlineMe1$2
|
||||
+ 2 2.kt
|
||||
_2Kt$box$1
|
||||
*L
|
||||
1#1,23:1
|
||||
20#2,2:24
|
||||
*E
|
||||
+5
@@ -3238,6 +3238,11 @@ public class BlackBoxInlineCodegenTestGenerated extends AbstractBlackBoxInlineCo
|
||||
runTest("compiler/testData/codegen/boxInline/smap/classFromDefaultPackage.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("crossroutines.kt")
|
||||
public void testCrossroutines() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/smap/crossroutines.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("defaultFunction.kt")
|
||||
public void testDefaultFunction() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/smap/defaultFunction.kt");
|
||||
|
||||
Generated
+5
@@ -3238,6 +3238,11 @@ public class CompileKotlinAgainstInlineKotlinTestGenerated extends AbstractCompi
|
||||
runTest("compiler/testData/codegen/boxInline/smap/classFromDefaultPackage.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("crossroutines.kt")
|
||||
public void testCrossroutines() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/smap/crossroutines.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("defaultFunction.kt")
|
||||
public void testDefaultFunction() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/smap/defaultFunction.kt");
|
||||
|
||||
+5
@@ -3238,6 +3238,11 @@ public class IrBlackBoxInlineCodegenTestGenerated extends AbstractIrBlackBoxInli
|
||||
runTest("compiler/testData/codegen/boxInline/smap/classFromDefaultPackage.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("crossroutines.kt")
|
||||
public void testCrossroutines() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/smap/crossroutines.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("defaultFunction.kt")
|
||||
public void testDefaultFunction() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/smap/defaultFunction.kt");
|
||||
|
||||
Generated
+5
@@ -3238,6 +3238,11 @@ public class IrCompileKotlinAgainstInlineKotlinTestGenerated extends AbstractIrC
|
||||
runTest("compiler/testData/codegen/boxInline/smap/classFromDefaultPackage.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("crossroutines.kt")
|
||||
public void testCrossroutines() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/smap/crossroutines.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("defaultFunction.kt")
|
||||
public void testDefaultFunction() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/smap/defaultFunction.kt");
|
||||
|
||||
Reference in New Issue
Block a user