Mark Unit unspillable if it is merged with unspillable Unit
#KT-42004: Fixed
This commit is contained in:
@@ -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
|
||||
}
|
||||
Reference in New Issue
Block a user