JS: initialize fields of coroutine state machine with undefined value so that they match local variable semantics. Fix KT-15366
This commit is contained in:
+30
@@ -0,0 +1,30 @@
|
||||
// MODULE: lib
|
||||
// FILE: lib.kt
|
||||
inline fun foo(x: String = "OK"): String {
|
||||
return x + x
|
||||
}
|
||||
|
||||
// MODULE: main(lib)
|
||||
// FILE: main.kt
|
||||
// WITH_RUNTIME
|
||||
// WITH_COROUTINES
|
||||
import kotlin.coroutines.*
|
||||
|
||||
var result = ""
|
||||
|
||||
fun builder(c: suspend () -> Unit) {
|
||||
c.startCoroutine(object : Continuation<Unit> {
|
||||
override fun resume(value: Unit) {
|
||||
}
|
||||
override fun resumeWithException(exception: Throwable) {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
builder {
|
||||
result = foo()
|
||||
}
|
||||
if (result != "OKOK") return "fail: $result"
|
||||
return "OK"
|
||||
}
|
||||
Reference in New Issue
Block a user