Anyone know if I have an inline function with a `c...
# library-development
m
Anyone know if I have an inline function with a
contract
defined, and another
inline
function points to it, do I also have to specify the
contract
in that inline function? E.g. Does
foo
also need the
contract
defined?
Copy code
public inline fun foo(block: () -> Unit): Boolean = bar(block)

@OptIn(ExperimentalContracts::class)
public inline fun bar(block: () -> Unit): Boolean {
    contract { callsInPlace(block, InvocationKind.AT_MOST_ONCE) }
    // ...
}
d
Yes, I believe the contract evaluation is performed before the inlining step
m
OK. Thanks Dan!