Add regression tests for obsolete issues
#KT-9304 #KT-14961 #KT-16549 #KT-21080 #KT-28234 #KT-30102 #KT-31994 #KT-34291 #KT-38099 #KT-41174 #KT-44622 #KT-44701 #KT-44781 #KT-44849 #KT-44978 #KT-45081 #KT-45286 #KT-45383 #KT-45444 #KT-45907
This commit is contained in:
Vendored
+22
@@ -0,0 +1,22 @@
|
||||
// IGNORE_BACKEND: JVM
|
||||
// WITH_RUNTIME
|
||||
// KT-44849
|
||||
|
||||
import kotlin.coroutines.*
|
||||
|
||||
var result = "Fail"
|
||||
|
||||
class Wrapper(val action: suspend () -> Unit) {
|
||||
init {
|
||||
action.startCoroutine(Continuation(EmptyCoroutineContext) { it.getOrThrow() })
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun some(a: String = "OK") {
|
||||
result = a
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
Wrapper(::some)
|
||||
return result
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
// WITH_RUNTIME
|
||||
// WITH_COROUTINES
|
||||
// IGNORE_BACKEND: JVM
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
|
||||
import kotlin.coroutines.*
|
||||
import helpers.*
|
||||
|
||||
suspend fun suspendThere(v: A): A = suspendCoroutine { x ->
|
||||
x.resume(v)
|
||||
}
|
||||
|
||||
class A(var value: Int)
|
||||
|
||||
suspend operator fun A?.plus(a: A) = suspendThere(A((this?.value ?: 0) + a.value))
|
||||
class B(var a: A)
|
||||
|
||||
fun builder(c: suspend () -> Unit) {
|
||||
c.startCoroutine(EmptyContinuation)
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
var b: B? = B(A(11))
|
||||
builder { b?.a += A(31) }
|
||||
if (b?.a?.value != 42) return "FAIL 0"
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// IGNORE_BACKEND: JVM
|
||||
// WITH_RUNTIME
|
||||
|
||||
import kotlin.coroutines.*
|
||||
|
||||
object MyObject2 {
|
||||
@JvmStatic
|
||||
suspend fun enable(o: Any) {
|
||||
if (o.hashCode() != 0) {
|
||||
suspendCoroutine<Any> {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun go(block: suspend () -> Unit) {
|
||||
block.startCoroutine(Continuation(EmptyCoroutineContext) { it.getOrThrow() })
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
go {
|
||||
MyObject2.enable("")
|
||||
}
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
import kotlin.coroutines.*
|
||||
|
||||
inline suspend fun foo(crossinline block: () -> String): String {
|
||||
return bar { _ -> block() }
|
||||
}
|
||||
|
||||
suspend fun bar(block: suspend (Int) -> String): String {
|
||||
return block(1)
|
||||
}
|
||||
|
||||
fun launch(block: suspend () -> String): String {
|
||||
var result = ""
|
||||
block.startCoroutine(Continuation(EmptyCoroutineContext) { result = it.getOrThrow() })
|
||||
return result
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
return launch {
|
||||
foo {
|
||||
"OK"
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user