Add several new SMAP tests
Some of them are still failing and suppose to be fixed later
This commit is contained in:
+38
@@ -0,0 +1,38 @@
|
||||
// WITH_STDLIB
|
||||
// NO_CHECK_LAMBDA_INLINING
|
||||
|
||||
// FILE: inline.kt
|
||||
|
||||
interface SuspendRunnable {
|
||||
suspend fun run()
|
||||
}
|
||||
|
||||
inline suspend fun inlineMe4(c: suspend () -> Unit) {
|
||||
c()
|
||||
}
|
||||
|
||||
inline suspend fun inlineMe14(crossinline c: suspend () -> Unit) = inlineMe4(c)
|
||||
|
||||
// FILE: box.kt
|
||||
import kotlin.coroutines.*
|
||||
|
||||
open class EmptyContinuation(override val context: CoroutineContext = EmptyCoroutineContext) : Continuation<Any?> {
|
||||
companion object : EmptyContinuation()
|
||||
override fun resumeWith(result: Result<Any?>) {
|
||||
result.getOrThrow()
|
||||
}
|
||||
}
|
||||
|
||||
fun builder(c: suspend () -> Unit) {
|
||||
c.startCoroutine(EmptyContinuation)
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
builder {
|
||||
inlineMe14 {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return "OK"
|
||||
}
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
// FILE: inline.kt
|
||||
SMAP
|
||||
inline.kt
|
||||
Kotlin
|
||||
*S Kotlin
|
||||
*F
|
||||
+ 1 inline.kt
|
||||
InlineKt
|
||||
*L
|
||||
1#1,16:1
|
||||
11#1,2:17
|
||||
*S KotlinDebug
|
||||
*F
|
||||
+ 1 inline.kt
|
||||
InlineKt
|
||||
*L
|
||||
14#1:17,2
|
||||
*E
|
||||
|
||||
// FILE: box.kt
|
||||
SMAP
|
||||
box.kt
|
||||
Kotlin
|
||||
*S Kotlin
|
||||
*F
|
||||
+ 1 box.kt
|
||||
BoxKt$box$1
|
||||
+ 2 inline.kt
|
||||
InlineKt
|
||||
*L
|
||||
1#1,39:1
|
||||
14#2:40
|
||||
11#2,2:41
|
||||
*S KotlinDebug
|
||||
*F
|
||||
+ 1 box.kt
|
||||
BoxKt$box$1
|
||||
*L
|
||||
32#1:40
|
||||
32#1:41,2
|
||||
*E
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
// FILE: 1.kt
|
||||
class A {
|
||||
inline val s: Int
|
||||
get() = 1
|
||||
}
|
||||
|
||||
// FILE: 2.kt
|
||||
fun box(): String {
|
||||
val a = A()
|
||||
var y = a.s
|
||||
y++
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
// FILE: 1.kt
|
||||
|
||||
// FILE: 2.kt
|
||||
SMAP
|
||||
2.kt
|
||||
Kotlin
|
||||
*S Kotlin
|
||||
*F
|
||||
+ 1 2.kt
|
||||
_2Kt
|
||||
+ 2 1.kt
|
||||
A
|
||||
*L
|
||||
1#1,15:1
|
||||
4#2:16
|
||||
*S KotlinDebug
|
||||
*F
|
||||
+ 1 2.kt
|
||||
_2Kt
|
||||
*L
|
||||
10#1:16
|
||||
*E
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
// WITH_STDLIB
|
||||
|
||||
// FILE: 1.kt
|
||||
inline fun g(block: () -> Unit) {
|
||||
block()
|
||||
}
|
||||
|
||||
var x: String? = null
|
||||
|
||||
fun compute(): String {
|
||||
try {
|
||||
for (a in listOf("a")) {
|
||||
g {
|
||||
for (b in listOf("b")) {
|
||||
return b
|
||||
}
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
x = "OK"
|
||||
}
|
||||
return "FAIL"
|
||||
}
|
||||
|
||||
// FILE: 2.kt
|
||||
|
||||
fun box(): String {
|
||||
val result = compute()
|
||||
if (result == "FAIL") return result
|
||||
return x ?: "FAIL"
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
// FILE: 1.kt
|
||||
SMAP
|
||||
1.kt
|
||||
Kotlin
|
||||
*S Kotlin
|
||||
*F
|
||||
+ 1 1.kt
|
||||
_1Kt
|
||||
*L
|
||||
1#1,25:1
|
||||
5#1,2:26
|
||||
*S KotlinDebug
|
||||
*F
|
||||
+ 1 1.kt
|
||||
_1Kt
|
||||
*L
|
||||
13#1:26,2
|
||||
*E
|
||||
|
||||
// FILE: 2.kt
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
// TARGET_BACKEND: JVM_IR
|
||||
// IGNORE_BACKEND_MULTI_MODULE: JVM_MULTI_MODULE_IR_AGAINST_OLD
|
||||
|
||||
// This test is just a cropped copy of `boxInline/nonLocalReturns/tryFinally/chained/nestedLambda.kt`
|
||||
// FILE: 1.kt
|
||||
|
||||
package test
|
||||
|
||||
class Holder {
|
||||
var value: String = ""
|
||||
}
|
||||
|
||||
inline fun <R> doCall(block: ()-> R, h: Holder) : R {
|
||||
try {
|
||||
return block()
|
||||
} finally {
|
||||
h.value += ", in doCall finally"
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: 2.kt
|
||||
|
||||
import test.*
|
||||
|
||||
inline fun test2(holder: Holder, l: (s: Int) -> Unit): String {
|
||||
try {
|
||||
var externalResult = doCall (ext@ {
|
||||
l(1)
|
||||
}, holder)
|
||||
|
||||
return "fail"
|
||||
}
|
||||
finally {
|
||||
holder.value += ", in global finally"
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
var holder = Holder()
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
// FILE: 1.kt
|
||||
|
||||
// FILE: 2.kt
|
||||
SMAP
|
||||
2.kt
|
||||
Kotlin
|
||||
*S Kotlin
|
||||
*F
|
||||
+ 1 2.kt
|
||||
_2Kt
|
||||
+ 2 1.kt
|
||||
test/_1Kt
|
||||
*L
|
||||
1#1,43:1
|
||||
14#2,4:44
|
||||
*S KotlinDebug
|
||||
*F
|
||||
+ 1 2.kt
|
||||
_2Kt
|
||||
*L
|
||||
27#1:44,4
|
||||
*E
|
||||
|
||||
Reference in New Issue
Block a user