-
Notifications
You must be signed in to change notification settings - Fork 107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for loop-contract historic values #3951
base: main
Are you sure you want to change the base?
Conversation
Looks like you want to run |
var_name | ||
} | ||
|
||
fn should_replace(&self, expr_path: &syn::ExprPath) -> bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add some comments to explain when should_replace
return true?
} | ||
} | ||
|
||
fn transform_function_calls( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add more comments to the newly added functions?
Could we use Some documentation describing the transformation at a high level would help the review. |
Check 10: loop_with_old.loop_invariant_base.1 | ||
- Status: SUCCESS | ||
- Description: "Check invariant before entry for loop loop_with_old.0" | ||
- Location: src/loop_with_old.rs:16:5 in function loop_with_old |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should remove details that will be brittle between runs (like the check number, or the .1). We also don't typically include location. You should have backslashes between the lines to enforce that the lines are consecutive--with this writing, something like this would pass:
loop_with_old.loop_invariant_base.1
- Status: FAILURE
random_other_check
- Status: SUCCESS
Without the backslashes, it'll just check for each line in isolation, so there's nothing tying the success to the particular property we care about.
I'd recommend looking at other expected files for examples.
Add support for
old
andprev
to refers to historic values in loop contracts whereold(expr)
refers to the value of the expr before the loop.prev(expr)
refers to the value of the expr at the previous iteration.Resolves #3697
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses.