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
cleanup
  • Loading branch information
alex-chew committed Jun 7, 2024
commit b1ebedd7badeb8245404be0d1510518ddd1cba8b
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ private record ReadsCheckDelayer(ExpressionTranslator etran, Function selfCallsA
wfOptions = wfOptions.WithLValueContext(false);
}

var readFrames = (codeContext as MethodOrFunction)?.Reads?.Expressions ?? new();
var readFrames = GetContextReadsFrames();

switch (expr) {
case StaticReceiverExpr stexpr: {
Expand Down Expand Up @@ -782,11 +782,7 @@ private record ReadsCheckDelayer(ExpressionTranslator etran, Function selfCallsA
var receiverSubstMap = readsReceiver.Ins.Zip(e.Args)
.ToDictionary(fa => fa.First as IVariable, fa => fa.Second);
var subst = new Substituter(receiverReplacement, receiverSubstMap, e.GetTypeArgumentSubstitutions());
requiredFrames = (readsReceiver! switch {
Method m => m.Reads,
Function f => f.Reads,
_ => throw new cce.UnreachableException()
}).Expressions.ConvertAll(subst.SubstFrameExpr);
requiredFrames = readsReceiver.Reads.Expressions.ConvertAll(subst.SubstFrameExpr);
break;
}
default:
Expand Down
3 changes: 1 addition & 2 deletions Source/DafnyCore/Verifier/BoogieGenerator.TrStatement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2046,8 +2046,7 @@ public partial class BoogieGenerator {
if (etran.readsFrame != null) {
// substitute actual args for parameter in frames for the description expression...
var requiredFrames = callee.Reads.Expressions.ConvertAll(directSub.SubstFrameExpr);
var readFrames = (codeContext as MethodOrFunction)?.Reads?.Expressions ?? new();
var desc = new PODesc.ReadFrameSubset("call", requiredFrames, readFrames);
var desc = new PODesc.ReadFrameSubset("call", requiredFrames, GetContextReadsFrames());

// ... but no need to do so for frames passed to CheckFrameSubset
var readsSubst = new Substituter(null, new Dictionary<IVariable, Expression>(), tySubst);
Expand Down
Loading