Fix tests after new Continuation API support
#KT-24863 Fixed
This commit is contained in:
@@ -24,5 +24,5 @@ fun box(): String {
|
||||
|
||||
// 2 GETSTATIC kotlin/Unit.INSTANCE
|
||||
// 1 GETSTATIC helpers/EmptyContinuation.Companion
|
||||
// 3 GETSTATIC kotlin\/coroutines\/experimental\/EmptyCoroutineContext.INSTANCE
|
||||
// 6 GETSTATIC
|
||||
// 4 GETSTATIC kotlin\/coroutines\/experimental\/EmptyCoroutineContext.INSTANCE
|
||||
// 7 GETSTATIC
|
||||
|
||||
+5
-7
@@ -1,12 +1,10 @@
|
||||
// LANGUAGE_VERSION: 1.3
|
||||
// WITH_RUNTIME
|
||||
// COMMON_COROUTINES_TEST
|
||||
// WITH_COROUTINES
|
||||
import helpers.*
|
||||
// TREAT_AS_ONE_FILE
|
||||
import COROUTINES_PACKAGE.*
|
||||
import COROUTINES_PACKAGE.intrinsics.*
|
||||
import kotlin.coroutines.*
|
||||
import kotlin.coroutines.intrinsics.*
|
||||
suspend fun suspendHere(): String = suspendCoroutineOrReturn { x ->
|
||||
x.resume("OK")
|
||||
x.resumeWith(SuccessOrFailure.success("OK"))
|
||||
}
|
||||
|
||||
suspend fun suspendThere(param: Int, param2: String, param3: Long): String {
|
||||
@@ -15,4 +13,4 @@ suspend fun suspendThere(param: Int, param2: String, param3: Long): String {
|
||||
return a + b
|
||||
}
|
||||
|
||||
// 0 ASTORE 4
|
||||
// 1 ASTORE 4
|
||||
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
// WITH_RUNTIME
|
||||
// WITH_COROUTINES
|
||||
import helpers.*
|
||||
// TREAT_AS_ONE_FILE
|
||||
import kotlin.coroutines.experimental.*
|
||||
import kotlin.coroutines.experimental.intrinsics.*
|
||||
suspend fun suspendHere(): String = suspendCoroutineOrReturn { 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
|
||||
Vendored
+49
@@ -0,0 +1,49 @@
|
||||
// WITH_RUNTIME
|
||||
// WITH_COROUTINES
|
||||
import helpers.*
|
||||
// TREAT_AS_ONE_FILE
|
||||
import kotlin.coroutines.experimental.*
|
||||
import kotlin.coroutines.experimental.intrinsics.*
|
||||
suspend fun suspendHere(): String = suspendCoroutineOrReturn { 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"
|
||||
} 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
|
||||
// But we do this because it's not illegal (at least in Android/OpenJDK VM's)
|
||||
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
|
||||
// 1 PUTFIELD VarValueConflictsWithTableSameSort_1_2Kt\$box\$1.L\$0 : Ljava/lang/Object;
|
||||
/* 1 load in try/finally */
|
||||
/* 1 load in result = s */
|
||||
/* 1 load before suspension point */
|
||||
// 3 ALOAD 3
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
// WITH_RUNTIME
|
||||
// WITH_COROUTINES
|
||||
import helpers.*
|
||||
// TREAT_AS_ONE_FILE
|
||||
import kotlin.coroutines.experimental.*
|
||||
import kotlin.coroutines.experimental.intrinsics.*
|
||||
suspend fun suspendHere(): String = suspendCoroutineOrReturn { 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
|
||||
Reference in New Issue
Block a user