-
Notifications
You must be signed in to change notification settings - Fork 16
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
Issue a warning when old
is used on a non-modified variable
#123
base: main
Are you sure you want to change the base?
Conversation
10dda3d
to
1b186eb
Compare
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.
Thanks ! I would argue for splitting the two new warnings, since one seems easier to implement than the other
| Tvar vs -> | ||
if | ||
not | ||
(List.exists | ||
(function { t_node = Tvar vs' } -> vs = vs' | _ -> false) | ||
wr) | ||
then Some vs.vs_name.id_str | ||
else None |
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.
I don't think that would be enough. For instance, you would reject the following:
val f : 'a array -> unit
(*@ f x
modifies x
ensures let y = x in old y.(0) = 0
You need a more subtle data flow analysis to know which variables are actually modified when you write modifies x
.
Co-authored-by: Clément Pascutto <[email protected]>
You mean in two different PRs? |
Co-authored-by: Clément Pascutto <[email protected]>
Co-authored-by: Clément Pascutto <[email protected]>
Co-authored-by: Clément Pascutto <[email protected]>
old
is used on a non-modified variable
Fixes #39.