Skip to content

Commit

Permalink
Added missing debug old labels around heap-dependent func apps, fixed…
Browse files Browse the repository at this point in the history
… line numbers in debug labels
  • Loading branch information
marcoeilers committed Feb 14, 2025
1 parent 3e7af48 commit 97d7c42
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 8 additions & 2 deletions src/main/scala/rules/Evaluator.scala
Original file line number Diff line number Diff line change
Expand Up @@ -859,6 +859,8 @@ object evaluator extends EvaluationRules {
evals2(s, eArgs, Nil, _ => pve, v)((s1, tArgs, eArgsNew, v1) => {
// bookkeeper.functionApplications += 1
val joinFunctionArgs = tArgs //++ c2a.quantifiedVariables.filterNot(tArgs.contains)
val (debugHeapName, debugLabel) = v1.getDebugOldLabel(s1, fapp.pos)
val s1a = if (Verifier.config.enableDebugging()) s1.copy(oldHeaps = s1.oldHeaps + (debugHeapName -> s1.h)) else s1
/* TODO: Does it matter that the above filterNot does not filter out quantified
* variables that are not "raw" function arguments, but instead are used
* in an expression that is used as a function argument?
Expand All @@ -869,7 +871,7 @@ object evaluator extends EvaluationRules {
* Hence, the joinedFApp will take two arguments, namely, i*i and i,
* although the latter is not necessary.
*/
joiner.join[(Term, Option[ast.Exp]), (Term, Option[ast.Exp])](s1, v1)((s2, v2, QB) => {
joiner.join[(Term, Option[ast.Exp]), (Term, Option[ast.Exp])](s1a, v1)((s2, v2, QB) => {
val pres = func.pres.map(_.transform {
/* [Malte 2018-08-20] Two examples of the test suite, one of which is the regression
* for Carbon issue #210, fail if the subsequent code that strips out triggers from
Expand Down Expand Up @@ -955,7 +957,11 @@ object evaluator extends EvaluationRules {
moreJoins = s2.moreJoins,
assertReadAccessOnly = s2.assertReadAccessOnly)
val funcAppNew = eArgsNew.map(args => ast.FuncApp(funcName, args)(fapp.pos, fapp.info, fapp.typ, fapp.errT))
QB(s5, (tFApp, funcAppNew), v3)})
val funcAppNewOld = Option.when(withExp)({
if (s5.isEvalInOld || pres.forall(_.isPure)) funcAppNew.get
else ast.DebugLabelledOld(funcAppNew.get, debugLabel)(fapp.pos, fapp.info, fapp.errT)
})
QB(s5, (tFApp, funcAppNewOld), v3)})
/* TODO: The join-function is heap-independent, and it is not obvious how a
* joined snapshot could be defined and represented
*/
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/verifier/Verifier.scala
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ trait Verifier {
*/
def getDebugOldLabel(s: State, pos: ast.Position, h: Option[Heap] = None): (String, String) = {
val posString = pos match {
case column: ast.HasLineColumn => s"l:${column.line + 1}.${column.column + 1}"
case column: ast.HasLineColumn => s"l:${column.line}.${column.column}"
case _ => s"l:unknown"
}
val heap = h match {
Expand Down

0 comments on commit 97d7c42

Please sign in to comment.