fitermay
01/02/2024, 1:28 AMcontract {
callsInPlace(block, InvocationKind.EXACTLY_ONCE)
}
Valid for a function which may throw before the invocation occurs? That is what if the invocation is guaranteed to occur if no exception is thrown beforehand?
Such as:
inline fun example(block: ()->Unit) {
contract {
callsInPlace(block, InvocationKind.EXACTLY_ONCE)
}
doSomeStuffThatMayThrow()
block()
}
loke
01/02/2024, 4:25 AMexample
completes, then block
has been executed completely.Youssef Shoaib [MOD]
01/02/2024, 5:01 PMblock
and doesn't rethrow it, then you should use AT_MOST_ONCE