Paul Woitaschek
10/09/2019, 7:26 AMfun functionImpl(a: Int, b: String) {}
fun nonSuspending(function: (Int, String) -> Unit) {}
fun suspending(function: suspend (Int, String) -> Unit) {}
fun test() {
nonSuspending(::functionImpl)
suspending(::functionImpl)
}
Marc Dietrichstein
10/09/2019, 7:35 AMfun suspending
requires a suspend
function but you pass functionImpl
which is not a suspend
function
The following code works for example:
fun functionImpl(a: Int, b: String) {}
suspend fun functionImplSuspending(a: Int, b: String) {}
fun nonSuspending(function: (Int, String) -> Unit) {}
fun suspending(function: suspend (Int, String) -> Unit) {}
fun test() {
nonSuspending(::functionImpl)
suspending(::functionImplSuspending)
}
Paul Woitaschek
10/09/2019, 7:36 AMThe design resolution is that conversion from regular functions to suspending function will be supported.Looks like it will be implemented. But it's from '17. I just refactored several classes from rxjava to flow and this made the migration a pain @elizarov
elizarov
10/09/2019, 11:01 AM