JVM: Mark suspend lambda receiver as used if callable reference

accesses it.
 #KT-44131 Fixed
This commit is contained in:
Ilmir Usmanov
2021-01-21 10:55:15 +01:00
parent de00f72fa3
commit 704366e531
9 changed files with 87 additions and 22 deletions
@@ -0,0 +1,20 @@
// WITH_RUNTIME
// KJS_WITH_FULL_RUNTIME
import kotlin.coroutines.*
fun box(): String = a { (::write)() }
fun builder(c: suspend () -> Unit) {
c.startCoroutine(Continuation(EmptyCoroutineContext) {})
}
fun a(a: suspend Writer.() -> String): String {
var res = ""
builder { res = Writer().a() }
return res
}
class Writer {
fun write(): String = "OK"
}