There is my code:
class AsyncProcessor(private val task: suspend CoroutineScope.() -> Unit) {
infix fun handleError(errHandler: (Throwable) -> Unit): AsyncProcessor {
...
return this
}
fun run(composite: AsyncBag): Job = ...
Here I return ‘this’ from handleError() in order to chain it with run() like that:
AsyncProcessor {
...
} handleError {
...
}.run(bag)
But turns out it can’t be done. Albeit, if i mark run() as infix, it can be achieved in the following way:
AsyncProcessor {
...
} handleError {
...
} run (bag)
If I’m doing everything right, it seems that even if an infix function returns this, it cannot be chained with an ordinary function
Why is that?