-
Notifications
You must be signed in to change notification settings - Fork 256
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
feat: Implement frame-related asserted exprs and TraitDecreases #5542
Merged
Merged
Changes from 1 commit
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
b99dd4c
implement frame-related asserted exprs and TraitDecreases
alex-chew 104f641
fix incorrect substitution for args to CheckFrameSubset
alex-chew b7ebc00
implement ReadFrameSubset asserted expr
alex-chew 2d9b962
formatting
alex-chew 0ecb0d2
Merge branch 'master' into alexchew/frame-podesc-exprs
alex-chew b1ebedd
cleanup
alex-chew 8e44ac9
fix MakeDafnyMultiFrameCheck with empty subsetFrames
alex-chew cc06580
clarify substitution comments
alex-chew 8d6b741
fix handling of FunctionCallExpr with non-method/function receiver
alex-chew 433d80b
fix untyped ThisExpr
alex-chew File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next
Next commit
implement frame-related asserted exprs and TraitDecreases
- Loading branch information
commit b99dd4c850ba006567eba08cc4dd5c9e4806b76b
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
Source/IntegrationTests/TestFiles/LitTests/LitTest/proof-obligation-desc/modifiable.dfy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
// RUN: %exits-with 4 %verify --show-proof-obligation-expressions "%s" > "%t" | ||
// RUN: %diff "%s.expect" "%t" | ||
|
||
class C { | ||
var x: int | ||
var y: int | ||
method ModifyClassField() | ||
modifies this`y | ||
{ | ||
x := 0; | ||
} | ||
} | ||
|
||
class C2 { | ||
var x: int | ||
var y: int | ||
} | ||
|
||
method ModifyObject(s: seq<C>, t: seq<C2>) | ||
requires |s| > 1 | ||
requires |t| > 0 | ||
// singletons | ||
modifies s[1] // no field | ||
modifies (s[1] as C)`x // right field | ||
modifies (s[0] as C)`y // right object, wrong field | ||
modifies (t[0] as C2)`x // wrong type, right field name | ||
// sets | ||
modifies {s[1]} // no field | ||
modifies {s[1] as C}`x // right field | ||
modifies {s[0] as C}`y // right object, wrong field | ||
modifies {t[0] as C2}`x // wrong type, right field name | ||
{ | ||
s[0].x := 1; | ||
} | ||
|
||
method ModifyObjects(s: seq<C>) | ||
requires |s| > 1 | ||
modifies s[1] | ||
modifies (set c | c in s)`y | ||
{ | ||
forall c | c in s { | ||
c.x := 1; | ||
} | ||
} | ||
|
||
method ModifyArray(a: array<int>, b: array<int>) | ||
modifies b | ||
{ | ||
if a.Length > 0 { | ||
a[0] := 1; | ||
} | ||
} | ||
|
||
method ModifyArrays(s: seq<array<int>>) | ||
requires |s| > 1 | ||
modifies s[1] | ||
{ | ||
forall a | a in s && a.Length > 0 { | ||
a[0] := 1; | ||
} | ||
} | ||
|
||
method ModifyMultiDimArray(a: array2<int>) | ||
{ | ||
if a.Length0 > 0 && a.Length1 > 0 { | ||
a[0, 0] := 1; | ||
} | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
The detail required in methods like these make me very much want to share this code with the Boogie translation eventually (i.e., have the Boogie generator work by constructing this expression and then translating it). But that's a task for another day.