Skip to content

Commit ecb4a1a

Browse files
authored
Added missing debug old labels around heap-dependent func apps, fixed line numbers in debug labels (#900)
1 parent 3e7af48 commit ecb4a1a

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

src/main/scala/rules/Evaluator.scala

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -859,6 +859,8 @@ object evaluator extends EvaluationRules {
859859
evals2(s, eArgs, Nil, _ => pve, v)((s1, tArgs, eArgsNew, v1) => {
860860
// bookkeeper.functionApplications += 1
861861
val joinFunctionArgs = tArgs //++ c2a.quantifiedVariables.filterNot(tArgs.contains)
862+
val (debugHeapName, debugLabel) = v1.getDebugOldLabel(s1, fapp.pos)
863+
val s1a = if (Verifier.config.enableDebugging()) s1.copy(oldHeaps = s1.oldHeaps + (debugHeapName -> s1.h)) else s1
862864
/* TODO: Does it matter that the above filterNot does not filter out quantified
863865
* variables that are not "raw" function arguments, but instead are used
864866
* in an expression that is used as a function argument?
@@ -869,7 +871,7 @@ object evaluator extends EvaluationRules {
869871
* Hence, the joinedFApp will take two arguments, namely, i*i and i,
870872
* although the latter is not necessary.
871873
*/
872-
joiner.join[(Term, Option[ast.Exp]), (Term, Option[ast.Exp])](s1, v1)((s2, v2, QB) => {
874+
joiner.join[(Term, Option[ast.Exp]), (Term, Option[ast.Exp])](s1a, v1)((s2, v2, QB) => {
873875
val pres = func.pres.map(_.transform {
874876
/* [Malte 2018-08-20] Two examples of the test suite, one of which is the regression
875877
* for Carbon issue #210, fail if the subsequent code that strips out triggers from
@@ -955,7 +957,11 @@ object evaluator extends EvaluationRules {
955957
moreJoins = s2.moreJoins,
956958
assertReadAccessOnly = s2.assertReadAccessOnly)
957959
val funcAppNew = eArgsNew.map(args => ast.FuncApp(funcName, args)(fapp.pos, fapp.info, fapp.typ, fapp.errT))
958-
QB(s5, (tFApp, funcAppNew), v3)})
960+
val funcAppNewOld = Option.when(withExp)({
961+
if (s5.isEvalInOld || pres.forall(_.isPure)) funcAppNew.get
962+
else ast.DebugLabelledOld(funcAppNew.get, debugLabel)(fapp.pos, fapp.info, fapp.errT)
963+
})
964+
QB(s5, (tFApp, funcAppNewOld), v3)})
959965
/* TODO: The join-function is heap-independent, and it is not obvious how a
960966
* joined snapshot could be defined and represented
961967
*/

src/main/scala/verifier/Verifier.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ trait Verifier {
5959
*/
6060
def getDebugOldLabel(s: State, pos: ast.Position, h: Option[Heap] = None): (String, String) = {
6161
val posString = pos match {
62-
case column: ast.HasLineColumn => s"l:${column.line + 1}.${column.column + 1}"
62+
case column: ast.HasLineColumn => s"l:${column.line}.${column.column}"
6363
case _ => s"l:unknown"
6464
}
6565
val heap = h match {

0 commit comments

Comments
 (0)