Skip to content
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

Read clauses on methods #30

Draft
wants to merge 59 commits into
base: master
Choose a base branch
from
Draft
Changes from 1 commit
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
1bf4616
First step, adding to parser and Method model
robin-aws Sep 16, 2021
6cf7685
Split TheFrame into ReadsFrame and ModifiesFrame
robin-aws Sep 17, 2021
e29db85
Just enough to support the first test case
robin-aws Sep 17, 2021
6fa7f62
Set default of "reads *" for methods
robin-aws Sep 17, 2021
c538c2b
Merge branch 'master' of https://github.com/dafny-lang/dafny into rea…
robin-aws Aug 4, 2023
12c9933
Partial fixes to bad merge
robin-aws Aug 4, 2023
41ee604
Remove zombie files from merge
robin-aws Aug 4, 2023
57d9919
More fixes
robin-aws Aug 4, 2023
dbb4ce0
Another batch of error fixes
robin-aws Aug 4, 2023
9ce3f2a
Finally builds
robin-aws Aug 4, 2023
905f103
Fix test
robin-aws Aug 4, 2023
bbeefdb
Address missing resolution etc.
robin-aws Aug 4, 2023
7f77f7c
Clean up WFOptions
robin-aws Aug 4, 2023
11d4a0d
Partially get test working
robin-aws Aug 4, 2023
20118e6
Missing cloning case
robin-aws Aug 14, 2023
f249adb
Default to reads *
robin-aws Aug 15, 2023
b2b266c
Tweaks
robin-aws Aug 15, 2023
e53422e
Fix iterators (different kind of reads frame)
robin-aws Aug 17, 2023
f1b1657
Avoid reads checks when reads clause is * (not working yet?)
robin-aws Aug 17, 2023
b2b3189
Test todos
robin-aws Aug 17, 2023
46f9367
Fixing check for wildcard, adding etran.WithReads/ModifiesClause()
robin-aws Aug 17, 2023
e94bc0f
Fix null readsFrame bug
robin-aws Aug 17, 2023
e0afd4a
Do reads checks on function by method bodies too
robin-aws Aug 17, 2023
f6dad35
Clean up test file
robin-aws Aug 17, 2023
267acae
Updates to documentation
robin-aws Aug 18, 2023
7518121
Whitespace
robin-aws Aug 18, 2023
4f4ace4
Apply reads clause to other clauses, {:concurrent} checks for empty f…
robin-aws Aug 19, 2023
22d8d4d
Typo fixes, more testing
robin-aws Aug 19, 2023
998b100
Add WithDelayedReadsChecks
robin-aws Aug 19, 2023
37fa445
Fix default values
robin-aws Aug 20, 2023
0a82760
Add ReadsCheckDelayer and apply it to other cases as well
robin-aws Aug 21, 2023
f7be5ed
Several missing calls to Method.Reads, beef up test cases
robin-aws Aug 21, 2023
1a0d6be
Whoops, dropping delayed reads checks statements
robin-aws Aug 21, 2023
38cdbf5
Subclassing and method call checks
robin-aws Aug 21, 2023
a00fc44
Enable reads checks on statements outside of method contexts
robin-aws Aug 22, 2023
0a54826
Trying out defaulting to `reads {}` on ghost methods
robin-aws Aug 22, 2023
22a4867
Lemmas instead of ghost methods
robin-aws Aug 23, 2023
347563e
No reads or checking on lemmas, more LHS fixes, more tests
robin-aws Aug 25, 2023
af497ec
update TODOs
robin-aws Aug 25, 2023
275e56d
Add option to enable, most testing (and reorganize old file tests)
robin-aws Aug 25, 2023
1386c43
More tests
robin-aws Aug 25, 2023
1cb1175
Cloning another test file
robin-aws Aug 25, 2023
0254121
Remaining tests
robin-aws Aug 25, 2023
82a160e
Whitespace and todos
robin-aws Aug 25, 2023
d376bf8
Merge branch 'master' of https://github.com/dafny-lang/dafny into rea…
robin-aws Aug 25, 2023
ee39edc
Fix function-by-method handling, update test
robin-aws Aug 26, 2023
85f9db2
PR feedback (more to come)
robin-aws Aug 29, 2023
71b0a2f
Merge duplicated code into AddMethodOverrideFrameSubsetChk
robin-aws Aug 29, 2023
5993220
More feedback (especially fixing {:concurrent} w.r.t. default reads!)
robin-aws Aug 29, 2023
96dde55
Address TODO about method specs referring to the set of allocated obj…
robin-aws Aug 29, 2023
b484dae
Mark test inconsistent with function version as expected for now
robin-aws Aug 29, 2023
1f8b12c
Couple of TODOs, remove extraneous code from AddMethodOverrideFrameSu…
robin-aws Aug 30, 2023
79d541a
Update expect files
robin-aws Aug 30, 2023
f16064a
Add “Do” to “WithDelayedReadsChecks”
robin-aws Aug 30, 2023
e27efe4
Reorder {:concurrent} checks
robin-aws Aug 30, 2023
3cdf36e
Merge branch 'master' of https://github.com/dafny-lang/dafny into rea…
robin-aws Aug 30, 2023
0acef7f
Whitespace
robin-aws Aug 30, 2023
5fcf4a3
Fix reference manual (options and attribute section numbering)
robin-aws Aug 30, 2023
33ac004
Merge branch 'master' of https://github.com/dafny-lang/dafny into rea…
robin-aws Aug 30, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Reorder {:concurrent} checks
  • Loading branch information
robin-aws committed Aug 30, 2023
commit e27efe48683a49368e3422f53cc135a8d9574e59
9 changes: 5 additions & 4 deletions Source/DafnyCore/Verifier/Translator.ClassMembers.cs
Original file line number Diff line number Diff line change
@@ -720,11 +720,12 @@ private void AddMethodImpl(Method m, Boogie.Procedure proc, bool wellformednessP
// check well-formedness of the modifies clauses
readsCheckDelayer.DoWithDelayedReadsChecks(false, wfo => {
CheckFrameWellFormed(wfo, m.Mod.Expressions, localVariables, builder, etran);
if (Attributes.Contains(m.Attributes, Attributes.ConcurrentAttributeName)) {
var desc = new PODesc.ConcurrentFrameEmpty("modifies clause");
CheckFrameEmpty(m.tok, etran, etran.ModifiesFrame(m.tok), builder, desc, null);
}
});
// Also check that the modifies clause == {} if the {:concurrent} attribute is present
if (Attributes.Contains(m.Attributes, Attributes.ConcurrentAttributeName)) {
var desc = new PODesc.ConcurrentFrameEmpty("modifies clause");
CheckFrameEmpty(m.tok, etran, etran.ModifiesFrame(m.tok), builder, desc, null);
}

// check well-formedness of the decreases clauses
foreach (Expression p in m.Decreases.Expressions) {
12 changes: 6 additions & 6 deletions Source/DafnyCore/Verifier/Translator.cs
Original file line number Diff line number Diff line change
@@ -4388,12 +4388,6 @@ void AddWellformednessCheck(Function f) {
DefineFrame(f.tok, etran.ReadsFrame(f.tok), f.Reads, builder, locals, null);
InitializeFuelConstant(f.tok, builder, etran);

// TODO: is this valid here given we haven't checked the well-formedness of the reads clauses yet?
if (Attributes.Contains(f.Attributes, Attributes.ConcurrentAttributeName)) {
var desc = new PODesc.ConcurrentFrameEmpty("reads clause");
CheckFrameEmpty(f.tok, etran, etran.ReadsFrame(f.tok), builder, desc, null);
}

var delayer = new ReadsCheckDelayer(etran, null, locals, builderInitializationArea, builder);

// Check well-formedness of any default-value expressions (before assuming preconditions).
@@ -4435,6 +4429,12 @@ void AddWellformednessCheck(Function f) {
delayer.DoWithDelayedReadsChecks(false, wfo => {
CheckFrameWellFormed(wfo, f.Reads, locals, builder, etran);
});

// If the function is marked as {:concurrent}, check that the reads clause is empty.
if (Attributes.Contains(f.Attributes, Attributes.ConcurrentAttributeName)) {
var desc = new PODesc.ConcurrentFrameEmpty("reads clause");
CheckFrameEmpty(f.tok, etran, etran.ReadsFrame(f.tok), builder, desc, null);
}

// check well-formedness of the decreases clauses (including termination, but no reads checks)
foreach (Expression p in f.Decreases.Expressions) {