Mark Unit unspillable if it is merged with unspillable Unit

#KT-42004: Fixed
This commit is contained in:
Ilmir Usmanov
2020-09-17 19:06:38 +02:00
parent f6e4705d9c
commit b406022315
9 changed files with 87 additions and 1 deletions
@@ -0,0 +1,32 @@
// WITH_RUNTIME
import kotlin.coroutines.*
var res: String = "FAIL"
class Log {
fun error(message: Any?) {
res = message as String
}
}
private val log = Log()
class C {
fun method() {}
}
fun <T : Any> df(t: T, r: suspend (T) -> Unit) {
r.startCoroutine(t, Continuation(EmptyCoroutineContext) {})
}
fun foo(s: String, c: C?) {
df(s) {
c?.method() ?: log.error(it)
}
}
fun box(): String {
foo("OK", null)
return res
}