Remove some remaining tests on old coroutines
This commit is contained in:
@@ -1,8 +0,0 @@
|
||||
// !LANGUAGE: -ExtendedMainConvention -ReleaseCoroutines
|
||||
// Does not run on JVM_IR since it uses experimental coroutines
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// WITH_RUNTIME
|
||||
|
||||
// uses kotlin.coroutines.experimental classes under the hood
|
||||
|
||||
suspend fun main(args: Array<String>) {}
|
||||
@@ -1,5 +0,0 @@
|
||||
@kotlin.Metadata
|
||||
public final class SuspendMain_beforeKt {
|
||||
// source: 'suspendMain_before.kt'
|
||||
public final static @org.jetbrains.annotations.Nullable method main(@org.jetbrains.annotations.NotNull p0: java.lang.String[], @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.experimental.Continuation): java.lang.Object
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
// !LANGUAGE: -ReleaseCoroutines
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// WITH_COROUTINES
|
||||
// TREAT_AS_ONE_FILE
|
||||
|
||||
import helpers.*
|
||||
import kotlin.coroutines.experimental.*
|
||||
import kotlin.coroutines.experimental.intrinsics.*
|
||||
|
||||
suspend fun suspendHere() = ""
|
||||
|
||||
fun builder(c: suspend () -> Unit) {
|
||||
c.startCoroutine(EmptyContinuation)
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
|
||||
for (i in 1..3) {
|
||||
builder {
|
||||
if (suspendHere() != "OK") throw java.lang.RuntimeException("fail 1")
|
||||
}
|
||||
}
|
||||
|
||||
return "OK"
|
||||
}
|
||||
|
||||
// 2 GETSTATIC kotlin/Unit.INSTANCE
|
||||
// 1 GETSTATIC helpers/EmptyContinuation.Companion
|
||||
// 3 GETSTATIC
|
||||
-34
@@ -1,34 +0,0 @@
|
||||
// !LANGUAGE: -ReleaseCoroutines
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// WITH_COROUTINES
|
||||
|
||||
import helpers.*
|
||||
import kotlin.coroutines.experimental.*
|
||||
import kotlin.coroutines.experimental.intrinsics.*
|
||||
|
||||
suspend fun dummy() {}
|
||||
|
||||
fun builder(c: suspend () -> Unit) {
|
||||
c.startCoroutine(EmptyContinuation)
|
||||
}
|
||||
|
||||
interface SuspendRunnable {
|
||||
suspend fun run(): String
|
||||
}
|
||||
|
||||
inline fun inlineMe(crossinline c: suspend () -> String) = object : SuspendRunnable {
|
||||
override suspend fun run() = c()
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
var res = "FAIL"
|
||||
builder {
|
||||
res = inlineMe { dummy(); "OK" }.run()
|
||||
}
|
||||
return res
|
||||
}
|
||||
|
||||
// Test for continuation of 'run' transformation.
|
||||
// Since continuation is not suspend lambda, it should not have state-machine.
|
||||
// @CrossinlineSuspendContinuation_1_2Kt$box$1$doResume$$inlined$inlineMe$1$1.class:
|
||||
// 0 TABLESWITCH
|
||||
-19
@@ -1,19 +0,0 @@
|
||||
// !LANGUAGE: -ReleaseCoroutines
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// WITH_COROUTINES
|
||||
|
||||
import helpers.*
|
||||
// TREAT_AS_ONE_FILE
|
||||
import kotlin.coroutines.experimental.*
|
||||
import kotlin.coroutines.experimental.intrinsics.*
|
||||
suspend fun suspendHere(): String = suspendCoroutineUninterceptedOrReturn { x ->
|
||||
x.resume("OK")
|
||||
}
|
||||
|
||||
suspend fun suspendThere(param: Int, param2: String, param3: Long): String {
|
||||
val a = suspendHere()
|
||||
val b = suspendHere()
|
||||
return a + b
|
||||
}
|
||||
|
||||
// 0 ASTORE 4
|
||||
-51
@@ -1,51 +0,0 @@
|
||||
// !LANGUAGE: -ReleaseCoroutines
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// WITH_COROUTINES
|
||||
|
||||
import helpers.*
|
||||
// TREAT_AS_ONE_FILE
|
||||
import kotlin.coroutines.experimental.*
|
||||
import kotlin.coroutines.experimental.intrinsics.*
|
||||
suspend fun suspendHere(): String = suspendCoroutineUninterceptedOrReturn { x ->
|
||||
x.resume("OK")
|
||||
}
|
||||
|
||||
fun builder(c: suspend () -> Unit) {
|
||||
c.startCoroutine(EmptyContinuation)
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
var result = "fail 1"
|
||||
|
||||
builder {
|
||||
// Initialize var with Int value
|
||||
try {
|
||||
var i: String = "abc"
|
||||
i = "123"
|
||||
println(i)
|
||||
} finally { }
|
||||
|
||||
// This variable should take the same slot as 'i' had
|
||||
var s: String
|
||||
|
||||
// We shout not spill 's' to continuation field because it's not effectively initialized
|
||||
if (suspendHere() == "OK") {
|
||||
s = "OK"
|
||||
}
|
||||
else {
|
||||
s = "fail 2"
|
||||
}
|
||||
|
||||
result = s
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
// 1 LOCALVARIABLE i Ljava/lang/String; L.* 3
|
||||
// 1 LOCALVARIABLE s Ljava/lang/String; L.* 3
|
||||
// 0 PUTFIELD VarValueConflictsWithTableSameSort_1_2Kt\$box\$1.L\$0 : Ljava/lang/Object;
|
||||
/* 1 load in try/finally */
|
||||
/* 1 load in result = s */
|
||||
/* 1 load in println */
|
||||
// 3 ALOAD 3
|
||||
-50
@@ -1,50 +0,0 @@
|
||||
// !LANGUAGE: -ReleaseCoroutines
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// WITH_COROUTINES
|
||||
|
||||
import helpers.*
|
||||
// TREAT_AS_ONE_FILE
|
||||
import kotlin.coroutines.experimental.*
|
||||
import kotlin.coroutines.experimental.intrinsics.*
|
||||
suspend fun suspendHere(): String = suspendCoroutineUninterceptedOrReturn { x ->
|
||||
x.resume("OK")
|
||||
}
|
||||
|
||||
fun builder(c: suspend () -> Unit) {
|
||||
c.startCoroutine(EmptyContinuation)
|
||||
}
|
||||
|
||||
val nonConstOne = 1
|
||||
|
||||
fun box(): String {
|
||||
var result = "fail 1"
|
||||
builder {
|
||||
// Initialize var with Int value
|
||||
for (i in 1..nonConstOne) {
|
||||
if ("".length > 0) continue
|
||||
}
|
||||
|
||||
// This variable should take the same slot as 'i' had
|
||||
var s: String
|
||||
|
||||
// We should not spill 's' to continuation field because it's not initialized
|
||||
// More precisely it contains a value of wrong type (it conflicts with contents of local var table),
|
||||
// so an attempt of spilling may lead to problems on Android
|
||||
if (suspendHere() == "OK") {
|
||||
s = "OK"
|
||||
}
|
||||
else {
|
||||
s = "fail 2"
|
||||
}
|
||||
|
||||
result = s
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
// 1 LOCALVARIABLE i I L.* 3
|
||||
// 1 LOCALVARIABLE s Ljava/lang/String; L.* 3
|
||||
// 0 PUTFIELD VarValueConflictsWithTableKt\$box\$1.I\$0 : I
|
||||
/* 2 loads in cycle */
|
||||
// 2 ILOAD 3
|
||||
-18
@@ -1,18 +0,0 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
// !LANGUAGE: -Coroutines -ReleaseCoroutines
|
||||
|
||||
suspend fun suspendHere(): String = "OK"
|
||||
|
||||
fun builder(c: suspend () -> Unit) {
|
||||
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
var result = ""
|
||||
|
||||
builder {
|
||||
suspendHere()
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
-18
@@ -1,18 +0,0 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
// !LANGUAGE: -Coroutines -ReleaseCoroutines
|
||||
|
||||
<!UNSUPPORTED_FEATURE!>suspend<!> fun suspendHere(): String = "OK"
|
||||
|
||||
fun builder(c: <!UNSUPPORTED_FEATURE!>suspend<!> () -> Unit) {
|
||||
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
var result = ""
|
||||
|
||||
<!UNSUPPORTED_FEATURE!>builder<!> {
|
||||
suspendHere()
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
-5
@@ -1,5 +0,0 @@
|
||||
package
|
||||
|
||||
public fun box(): kotlin.String
|
||||
public fun builder(/*0*/ c: suspend () -> kotlin.Unit): kotlin.Unit
|
||||
public suspend fun suspendHere(): kotlin.String
|
||||
Vendored
-18
@@ -1,18 +0,0 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
// !LANGUAGE: warn:Coroutines -ReleaseCoroutines
|
||||
|
||||
suspend fun suspendHere(): String = "OK"
|
||||
|
||||
fun builder(c: suspend () -> Unit) {
|
||||
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
var result = ""
|
||||
|
||||
builder {
|
||||
suspendHere()
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
-18
@@ -1,18 +0,0 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
// !LANGUAGE: warn:Coroutines -ReleaseCoroutines
|
||||
|
||||
<!EXPERIMENTAL_FEATURE_WARNING!>suspend<!> fun suspendHere(): String = "OK"
|
||||
|
||||
fun builder(c: <!EXPERIMENTAL_FEATURE_WARNING!>suspend<!> () -> Unit) {
|
||||
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
var result = ""
|
||||
|
||||
<!EXPERIMENTAL_FEATURE_WARNING!>builder<!> {
|
||||
suspendHere()
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
-5
@@ -1,5 +0,0 @@
|
||||
package
|
||||
|
||||
public fun box(): kotlin.String
|
||||
public fun builder(/*0*/ c: suspend () -> kotlin.Unit): kotlin.Unit
|
||||
public suspend fun suspendHere(): kotlin.String
|
||||
Vendored
-38
@@ -1,38 +0,0 @@
|
||||
// !LANGUAGE: -ReleaseCoroutines
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -EXPERIMENTAL_FEATURE_WARNING
|
||||
// !CHECK_TYPE
|
||||
// !WITH_NEW_INFERENCE
|
||||
// SKIP_TXT
|
||||
|
||||
import kotlin.coroutines.*
|
||||
import kotlin.coroutines.intrinsics.*
|
||||
|
||||
class Controller {
|
||||
suspend fun noParams(): Unit = suspendCoroutineUninterceptedOrReturn {
|
||||
if (hashCode() % 2 == 0) {
|
||||
it.resume(Unit)
|
||||
COROUTINE_SUSPENDED
|
||||
}
|
||||
else {
|
||||
Unit
|
||||
}
|
||||
}
|
||||
suspend fun yieldString(value: String) = suspendCoroutineUninterceptedOrReturn<Int> {
|
||||
it.resume(1)
|
||||
it checkType { _<Continuation<Int>>() }
|
||||
it.<!INAPPLICABLE_CANDIDATE!>resume<!>("")
|
||||
|
||||
// We can return anything here, 'suspendCoroutineUninterceptedOrReturn' is not very type-safe
|
||||
// Also we can call resume and then return the value too, but it's still just our problem
|
||||
"Not-int"
|
||||
}
|
||||
}
|
||||
|
||||
fun builder(c: suspend Controller.() -> Unit) {}
|
||||
|
||||
fun test() {
|
||||
builder {
|
||||
noParams() checkType { _<Unit>() }
|
||||
yieldString("abc") checkType { _<Int>() }
|
||||
}
|
||||
}
|
||||
-38
@@ -1,38 +0,0 @@
|
||||
// !LANGUAGE: -ReleaseCoroutines
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -EXPERIMENTAL_FEATURE_WARNING
|
||||
// !CHECK_TYPE
|
||||
// !WITH_NEW_INFERENCE
|
||||
// SKIP_TXT
|
||||
|
||||
import kotlin.coroutines.*
|
||||
import kotlin.coroutines.intrinsics.*
|
||||
|
||||
class Controller {
|
||||
suspend fun noParams(): Unit = suspendCoroutineUninterceptedOrReturn {
|
||||
if (hashCode() % 2 == 0) {
|
||||
it.resume(Unit)
|
||||
COROUTINE_SUSPENDED
|
||||
}
|
||||
else {
|
||||
Unit
|
||||
}
|
||||
}
|
||||
suspend fun yieldString(value: String) = suspendCoroutineUninterceptedOrReturn<Int> {
|
||||
it.resume(1)
|
||||
it checkType { _<Continuation<Int>>() }
|
||||
it.<!TYPE_INFERENCE_CONFLICTING_SUBSTITUTIONS{OI}!>resume<!>(<!TYPE_MISMATCH{NI}!>""<!>)
|
||||
|
||||
// We can return anything here, 'suspendCoroutineUninterceptedOrReturn' is not very type-safe
|
||||
// Also we can call resume and then return the value too, but it's still just our problem
|
||||
"Not-int"
|
||||
}
|
||||
}
|
||||
|
||||
fun builder(c: suspend Controller.() -> Unit) {}
|
||||
|
||||
fun test() {
|
||||
builder {
|
||||
noParams() checkType { _<Unit>() }
|
||||
yieldString("abc") checkType { _<Int>() }
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
// !LANGUAGE: -Coroutines -ReleaseCoroutines
|
||||
|
||||
suspend fun suspendHere(): String = "OK"
|
||||
|
||||
fun builder(c: suspend () -> Unit) {
|
||||
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
var result = ""
|
||||
|
||||
builder {
|
||||
suspendHere()
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
// !LANGUAGE: -Coroutines -ReleaseCoroutines
|
||||
|
||||
<!UNSUPPORTED_FEATURE!>suspend<!> fun suspendHere(): String = "OK"
|
||||
|
||||
fun builder(c: <!UNSUPPORTED_FEATURE!>suspend<!> () -> Unit) {
|
||||
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
var result = ""
|
||||
|
||||
<!UNSUPPORTED_FEATURE!>builder<!> {
|
||||
suspendHere()
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
package
|
||||
|
||||
public fun box(): kotlin.String
|
||||
public fun builder(/*0*/ c: suspend () -> kotlin.Unit): kotlin.Unit
|
||||
public suspend fun suspendHere(): kotlin.String
|
||||
Reference in New Issue
Block a user