uli
09/26/2019, 10:55 AMDico
09/26/2019, 10:57 AMuli
09/26/2019, 11:04 AMclass X {
suspend fun suspending() {}
suspend fun test1() {
// Error goes away if we add suspend modifier to logError an it's parameter block
// But then IDE complains about redundant suspend modifier
logError(::suspending)
}
suspend fun test2() {
logError { suspending() }
}
inline fun logError(block: () -> Unit) {
try {
block()
} catch (e: Exception) {
//Log Exception
}
}
}
Vsevolod Tolstopyatov [JB]
09/26/2019, 11:22 AMuli
09/26/2019, 11:52 AMwrong bytecode generated
error for this:
class X {
suspend fun suspending() {}
suspend fun test() {
logError(::suspending)
}
suspend inline fun runBlock(block: suspend () -> Unit) {
logError(block)
}
suspend inline fun logError(block: suspend () -> Unit) {
try {
block()
} catch (e: Exception) {
//Log Exception
}
}
}
Ilmir Usmanov [JB]
09/26/2019, 12:33 PMuli
09/26/2019, 12:45 PM