You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The example below illustrates a difference in behaviour between invoking a function — which entails asserting its precondition — and explicitly asserting the function's precondition: in the former case, the precondition is not assumed to hold afterwards.
field f: Int
function foo(x: Ref): Bool
requires acc(x.f)
method test(x: Ref) {
inhale acc(x.f) && x.f == 1
var y: Ref
assert foo(y) // Error: insuff. permissions
assert acc(y.f) // Error: insuff. permissions
assert y.f == 1 // No error, thanks to assert
}
The text was updated successfully, but these errors were encountered:
The example below illustrates a difference in behaviour between invoking a function — which entails asserting its precondition — and explicitly asserting the function's precondition: in the former case, the precondition is not assumed to hold afterwards.
The text was updated successfully, but these errors were encountered: