Contract in CloseableReferenceCounter_Debug.withRef

This commit is contained in:
Andrew Golovashevich 2025-08-16 19:33:56 +03:00
parent 3302c67fa6
commit 4b63563cbd
2 changed files with 5 additions and 2 deletions

View File

@ -129,6 +129,9 @@ public class CloseableReferenceCounter_Debug {
@JvmName("withRef\$kt") @JvmName("withRef\$kt")
public inline fun <R> withRef(protected: () -> R): R { public inline fun <R> withRef(protected: () -> R): R {
contract {
callsInPlace(protected, InvocationKind.EXACTLY_ONCE)
}
this.incref() this.incref()
return safeAutoClose1(finally = this::decref, action = protected) return safeAutoClose1(finally = this::decref, action = protected)
} }

View File

@ -95,9 +95,9 @@ public class CloseableReferenceCounter_Debug {
@JvmName("withRef\$kt") @JvmName("withRef\$kt")
public inline fun <R> withRef(protected: () -> R): R { public inline fun <R> withRef(protected: () -> R): R {
/*contract { contract {
callsInPlace(protected, InvocationKind.EXACTLY_ONCE) callsInPlace(protected, InvocationKind.EXACTLY_ONCE)
}*/ }
return this._moved.withRef(protected) return this._moved.withRef(protected)
} }