Skip to content

Commit 972704b

Browse files
committed
Fixed issue 234: Test case linked-list-predicates doesn't reliably terminate.
1 parent 7fce399 commit 972704b

3 files changed

Lines changed: 7 additions & 4 deletions

File tree

src/main/scala/viper/silver/ast/Expression.scala

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -478,6 +478,10 @@ case class LabelledOld(exp: Exp, oldLabel: String)(val pos: Position = NoPositio
478478
Consistency.checkPure(exp)
479479
}
480480

481+
case object LabelledOld {
482+
val LhsOldLabel = "lhs"
483+
}
484+
481485
// --- Other expressions
482486

483487
case class Let(variable: LocalVarDecl, exp: Exp, body: Exp)(val pos: Position = NoPosition, val info: Info = NoInfo, val errT: ErrorTrafo = NoTrafos) extends Exp with Scope {

src/main/scala/viper/silver/ast/utility/Consistency.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ object Consistency {
339339

340340
c.copy(insideWandStatus = InsideWandStatus.Yes)
341341

342-
case po@LabelledOld(_, FastParser.LHS_OLD_LABEL) if !c.insideWandStatus.isInside =>
342+
case po@LabelledOld(_, LabelledOld.LhsOldLabel) if !c.insideWandStatus.isInside =>
343343
s :+= ConsistencyError("Labelled old expressions with \"lhs\" label may only occur inside wands and their proof scripts.", po.pos)
344344
c
345345

@@ -374,7 +374,7 @@ object Consistency {
374374
s ++= checkWandRelatedOldExpressions(lhs, c.copy(insideWandStatus = InsideWandStatus.Left))
375375
s ++= checkWandRelatedOldExpressions(rhs, c.copy(insideWandStatus = InsideWandStatus.Right))
376376

377-
case po @ LabelledOld(_, FastParser.LHS_OLD_LABEL) if !c.insideWandStatus.isRight =>
377+
case po @ LabelledOld(_, LabelledOld.LhsOldLabel) if !c.insideWandStatus.isRight =>
378378
s :+= ConsistencyError("Wands may use the old[lhs]-expression on the rhs and in their proof script only.", po.pos)
379379
})
380380
s

src/main/scala/viper/silver/ast/utility/Expressions.scala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import viper.silver.ast._
1111
import viper.silver.ast.utility.rewriter.Traverse
1212
import viper.silver.ast.utility.Triggers.TriggerGeneration
1313
import viper.silver.utility.Sanitizer
14-
import viper.silver.parser.FastParser
1514

1615
/** Utility methods for expressions. */
1716
object Expressions {
@@ -65,7 +64,7 @@ object Expressions {
6564
currentState => //if (depends) PartialFunction.empty // we're done
6665
//else
6766
{
68-
case LabelledOld(ee, FastParser.LHS_OLD_LABEL) =>
67+
case LabelledOld(ee, LabelledOld.LhsOldLabel) =>
6968
if (treatMagicWandStatesAsCurrentStates)
7069
go(ee,p,true)
7170
else

0 commit comments

Comments
 (0)