Files
kotlin-fork/compiler/testData/compileKotlinAgainstCustomBinaries/suspensionPointInMonitor/source.kt
T
Ilmir Usmanov 9af7316845 Add call checker to report error more granulary if possible
This, however, works only for calls of 'synchronized' only. Thus, it
does not support inline functions of any kind.
2018-10-09 22:55:51 +03:00

39 lines
609 B
Kotlin
Vendored

fun builder(c: suspend () -> Unit) {}
private val lock = Any()
suspend fun suspensionPoint() {}
fun test() {
builder {
inlineMe {
suspensionPoint()
}
}
builder {
monitorInFinally(
{},
{ suspensionPoint() }
)
}
synchronized(lock) {
builder {
suspensionPoint()
}
}
synchronized(lock) {
object : SuspendRunnable {
override suspend fun run() {
suspensionPoint()
}
}
}
}
interface SuspendRunnable {
suspend fun run()
}