Hey guys, is there any way to get contracts like c...
# multiplatform
h
Hey guys, is there any way to get contracts like callsInPlace working with
expect inline fun
? Or is there some known workaround at the moment without writing another function that's just a pass through?
a
You can add body with contract for expect fun and suppress the error
Copy code
@OptIn(ExperimentalContracts::class)
@Suppress("EXPECTED_DECLARATION_WITH_BODY")
expect inline fun foo(block: () -> Unit) : Any {
    contract {
        callsInPlace(block, InvocationKind.EXACTLY_ONCE)
    }
    error("Unreachable")
}
thank you color 1