Can't compile invokeOnCompletion with onCancelling option


#1

I have problems getting the following code to compile on JS (the code compiles fine for the JVM).

The problem is at invokeOnCompletion. The compiler says:
Cannot find a parameter with this name: onCancelling

suspend fun <T> Future<T>.awaitCancellable() = suspendCancellableCoroutine<T> { cont ->
    cont.invokeOnCompletion(onCancelling = true) {
        cancel()
    }
    ...
}

I tried various variation to call invokeOnCompletion but they all do not compile. Am I doing something wrong or is it a JS compiler bug?


#2

cc @elizarov