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

feat: Implement frame-related asserted exprs and TraitDecreases #5542

Merged
merged 10 commits into from
Jun 7, 2024
Prev Previous commit
Next Next commit
fix incorrect substitution for args to CheckFrameSubset
  • Loading branch information
alex-chew committed Jun 7, 2024
commit 104f6417d28cf3f273f379396ad67a2df2cd1e8e
15 changes: 11 additions & 4 deletions Source/DafnyCore/Verifier/BoogieGenerator.TrStatement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2052,10 +2052,17 @@ void ProcessCallStmt(CallStmt cs, Dictionary<TypeParameter, Type> tySubst, Bpl.E
// Check that the modifies clause of a subcall is a subset of the current modifies frame,
// but only if we're in a context that defines a modifies frame.
if (codeContext is IMethodCodeContext methodCodeContext) {
var modifiesSubst = new Substituter(null, directSubstMap, tySubst);
var calleeFrame = callee.Mod.Expressions.ConvertAll(modifiesSubst.SubstFrameExpr);
var desc = new PODesc.ModifyFrameSubset("call", calleeFrame, methodCodeContext.Modifies.Expressions);
CheckFrameSubset(tok, calleeFrame,
// substitute actual args for parameters in frames for the description expression...
var descSubst = new Substituter(null, directSubstMap, tySubst);
var desc = new PODesc.ModifyFrameSubset(
"call",
callee.Mod.Expressions.ConvertAll(descSubst.SubstFrameExpr),
methodCodeContext.Modifies.Expressions
);
// ... but no need to do so for frames passed to CheckFrameSubset
var modifiesSubst = new Substituter(null, new(), tySubst);
CheckFrameSubset(
tok, callee.Mod.Expressions.ConvertAll(modifiesSubst.SubstFrameExpr),
receiver, substMap, etran, etran.ModifiesFrame(tok), builder, desc, null);
}

Expand Down
Loading