Skip to content

Commit 5ae04b0

Browse files
committed
Replace old expressions in all assert and assume in the method
1 parent 5c59b37 commit 5ae04b0

File tree

3 files changed

+21
-2
lines changed

3 files changed

+21
-2
lines changed

src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -638,9 +638,9 @@ fn cmd_to_ivlcmd(cmd: &Cmd, method_context: &MethodContext, loop_context: &LoopC
638638
let &Cmd { kind, span, .. } = &cmd;
639639
Ok(match kind {
640640
CmdKind::Assert { condition, message } =>
641-
IVLCmd::assert(condition, message),
641+
IVLCmd::assert(&replace_old_in_expression(condition, &method_context.global_variables_old_values), message),
642642
CmdKind::Assume { condition} =>
643-
IVLCmd::assume(condition),
643+
IVLCmd::assume(&replace_old_in_expression(condition, &method_context.global_variables_old_values)),
644644
CmdKind::Seq(cmd1, cmd2) =>
645645
cmd_to_ivlcmd(cmd1, &method_context, loop_context)?.seq(
646646
&cmd_to_ivlcmd(cmd2, &method_context, loop_context)?),
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
global x: Int := 2
2+
3+
method c()
4+
modifies x
5+
6+
{
7+
x := x + 1;
8+
// @CheckError
9+
assert x == old(x) + 2
10+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
global x: Int := 2
2+
3+
method c()
4+
modifies x
5+
6+
{
7+
x := x + 1;
8+
assert x == old(x) + 1
9+
}

0 commit comments

Comments
 (0)