Skip to content

Commit

Permalink
Merge pull request #750 from viperproject/meilers_fix_749
Browse files Browse the repository at this point in the history
Fixing unknown function error by recording snapshot masks
  • Loading branch information
marcoeilers authored Sep 22, 2023
2 parents b7bc9ba + 0bfabda commit 2e306af
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions src/main/scala/rules/Evaluator.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1416,13 +1416,15 @@ object evaluator extends EvaluationRules {
triggerAxioms = triggerAxioms ++ axioms
smDefs = smDefs ++ smDef
case pa: ast.PredicateAccess if s.heapDependentTriggers.contains(pa.loc(s.program)) =>
val (axioms, trigs, _) = generatePredicateTrigger(pa, s, pve, v)
val (axioms, trigs, _, smDef) = generatePredicateTrigger(pa, s, pve, v)
triggers = triggers ++ trigs
triggerAxioms = triggerAxioms ++ axioms
smDefs = smDefs ++ smDef
case wand: ast.MagicWand if s.heapDependentTriggers.contains(MagicWandIdentifier(wand, s.program)) =>
val (axioms, trigs, _) = generateWandTrigger(wand, s, pve, v)
val (axioms, trigs, _, smDef) = generateWandTrigger(wand, s, pve, v)
triggers = triggers ++ trigs
triggerAxioms = triggerAxioms ++ axioms
smDefs = smDefs ++ smDef
case e => evalTrigger(s, Seq(e), pve, v)((_, t, _) => {
triggers = triggers ++ t
Success()
Expand Down Expand Up @@ -1502,7 +1504,11 @@ object evaluator extends EvaluationRules {
}

/* TODO: Try to unify with generateFieldTrigger above, or at least with generateWandTrigger below */
private def generatePredicateTrigger(pa: ast.PredicateAccess, s: State, pve: PartialVerificationError, v: Verifier): (Seq[Term], Seq[Term], PredicateTrigger) = {
private def generatePredicateTrigger(pa: ast.PredicateAccess,
s: State,
pve: PartialVerificationError,
v: Verifier)
: (Seq[Term], Seq[Term], PredicateTrigger, Seq[SnapshotMapDefinition]) = {
var axioms = Seq.empty[Term]
var triggers = Seq.empty[Term]
var mostRecentTrig: PredicateTrigger = null
Expand All @@ -1524,11 +1530,15 @@ object evaluator extends EvaluationRules {
Success()
})

(axioms, triggers, mostRecentTrig)
(axioms, triggers, mostRecentTrig, Seq(smDef1))
}

/* TODO: See comments for generatePredicateTrigger above */
private def generateWandTrigger(wand: ast.MagicWand, s: State, pve: PartialVerificationError, v: Verifier): (Seq[Term], Seq[Term], PredicateTrigger) = {
private def generateWandTrigger(wand: ast.MagicWand,
s: State,
pve: PartialVerificationError,
v: Verifier)
: (Seq[Term], Seq[Term], PredicateTrigger, Seq[SnapshotMapDefinition]) = {
var axioms = Seq.empty[Term]
var triggers = Seq.empty[Term]
var mostRecentTrig: PredicateTrigger = null
Expand All @@ -1552,7 +1562,7 @@ object evaluator extends EvaluationRules {
Success()
})

(axioms, triggers, mostRecentTrig)
(axioms, triggers, mostRecentTrig, Seq(smDef1))
}

/* Evaluate a sequence of expressions in Order
Expand Down

0 comments on commit 2e306af

Please sign in to comment.