Fix compatibility of suspend functions with strict bytecode analyzers

In short, some of the bytecode analyzers assume that there could be
no stores instructions into parameter vars with value of different
types (even when the value type is a subtype)

See the issue for details

 #KT-19713 Fixed
This commit is contained in:
Denis Zharkov
2017-08-17 16:36:02 +07:00
parent d5f0607cef
commit fcd7677a3f
3 changed files with 36 additions and 3 deletions
@@ -0,0 +1,18 @@
// 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
}
/* 2 stores happen because the continuation parameter is visible in debug and should be spilled */
// 2 ASTORE 4