-
Notifications
You must be signed in to change notification settings - Fork 257
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
Linter rule: old
should only refer to heap values
#1989
Labels
kind: enhancement
Enhancements, feature requests, etc. These are NOT bugs, but ways we can improve Dafny
part: resolver
Resolution and typechecking
Comments
mschlaipfer
added
the
kind: enhancement
Enhancements, feature requests, etc. These are NOT bugs, but ways we can improve Dafny
label
Apr 8, 2022
I guess you want to receive a warning when |
Yes, exactly. |
keyboardDrummer
pushed a commit
that referenced
this issue
Sep 2, 2022
Fixes #1989 If the argument to `old` has no dereferences of the mutable heap, generate a warning saying that the `old` has no effect. This has been a common source of errors and confusion.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
kind: enhancement
Enhancements, feature requests, etc. These are NOT bugs, but ways we can improve Dafny
part: resolver
Resolution and typechecking
Dafny does not provide a warning when using the
old
keyword on immutable values. This doesn't make sense and can lead to misunderstanding. Pointing this out in an analysis exposed via the IDE would clear this up.For example, the following code verifies, and it's not immediately obvious why.
The reason that
assert(arrSet(a) == arrSet(old(a)));
verifies is thatold(a)
refers to the reference, and not to the values ina
. This is documented, but a linter pass warning about usingold
on an immutable value would be helpful.The text was updated successfully, but these errors were encountered: