Fix continuaion retrieval on generated coroutineContext intrinsic code

Use fake continuation instead on real one in JVM BE.
Pass continuation parameter to closure generator in JS BE.

 #KT-22577: Fixed
This commit is contained in:
Ilmir Usmanov
2018-02-02 20:48:17 +03:00
parent e8cd8b566e
commit ad385f42a9
11 changed files with 111 additions and 22 deletions
@@ -0,0 +1,33 @@
// WITH_RUNTIME
// WITH_COROUTINES
import helpers.*
import kotlin.coroutines.experimental.*
inline fun inlinedLambda(block: () -> Unit) {
return block()
}
suspend fun useInlined(): Boolean {
inlinedLambda { return coroutineContext === EmptyCoroutineContext }
return false
}
fun builder(c: suspend () -> Unit) {
c.startCoroutine(EmptyContinuation)
}
fun box(): String {
var res = "FAIL 1"
builder {
if (useInlined())
res = "OK"
}
if (res != "OK") return res
res = "FAIL 2"
builder {
inlinedLambda {
res = if (coroutineContext === EmptyCoroutineContext) "OK" else "FAIL 3"
}
}
return res
}