@@ -13,7 +13,7 @@ import viper.silicon.interfaces.SiliconMappedCounterexample
1313import viper .silicon .reporting .{ExtractedModel , ExtractedModelEntry , LitIntEntry , LitPermEntry , NullRefEntry , RecursiveRefEntry , RefEntry , SeqEntry }
1414import viper .silicon .state .terms .Rational
1515import viper .silver .parser .FastParserCompanion .whitespace
16- import viper .silver .parser .{FastParser , PAccPred , PBinExp , PExp , PFieldAccess , PIdnUse , PIntLit , PLookup , PUnExp }
16+ import viper .silver .parser .{FastParser , PAccPred , PBinExp , PExp , PFieldAccess , PIdnUse , PIntLit , PLookup , PUnExp , PSymOp }
1717import viper .silver .verifier .{FailureContext , VerificationError }
1818
1919import java .nio .file .Path
@@ -112,7 +112,7 @@ case class ExpectedCounterexampleAnnotation(id: OutputAnnotationId, file: Path,
112112 def meetsExpectations (model1 : ExpectedCounterexample , model2 : ExtractedModel ): Boolean = {
113113 model1.exprs.forall {
114114 case accPred : PAccPred => containsAccessPredicate(accPred, model2)
115- case PBinExp (lhs, " == " , rhs) => containsEquality(lhs, rhs, model2)
115+ case PBinExp (lhs, r , rhs) if r.rs == PSymOp . EqEq => containsEquality(lhs, rhs, model2)
116116 }
117117 }
118118
@@ -130,13 +130,13 @@ case class ExpectedCounterexampleAnnotation(id: OutputAnnotationId, file: Path,
130130 /** resolves `expr` to a model entry in the given model. In case it's a field access, the corresponding permissions are returned as well */
131131 def resolve (expr : PExp , model : ExtractedModel ): Option [(ExtractedModelEntry , Option [Rational ])] = expr match {
132132 case PIntLit (value) => Some (LitIntEntry (value), None )
133- case PUnExp (" - " , PIntLit (value)) => Some (LitIntEntry (- value), None )
134- case PBinExp (PIntLit (n), " / " , PIntLit (d)) => Some (LitPermEntry (Rational (n, d)), None )
135- case PIdnUse (name) => model.entries.get(name).map((_, None ))
136- case PFieldAccess (rcv, idnuse) => resolveWoPerm(rcv, model).flatMap {
133+ case PUnExp (r , PIntLit (value)) if r.rs == PSymOp . Neg => Some (LitIntEntry (- value), None )
134+ case PBinExp (PIntLit (n), r , PIntLit (d)) if r.rs == PSymOp . Div => Some (LitPermEntry (Rational (n, d)), None )
135+ case idnuse : PIdnUse => model.entries.get(idnuse. name).map((_, None ))
136+ case PFieldAccess (rcv, _, idnuse) => resolveWoPerm(rcv, model).flatMap {
137137 case RefEntry (_, fields) => fields.get(idnuse.name)
138138 }
139- case PLookup (base, idx) => resolveWoPerm(Vector (base, idx), model).flatMap {
139+ case PLookup (base, _, idx, _ ) => resolveWoPerm(Vector (base, idx), model).flatMap {
140140 case Vector (SeqEntry (_, values), LitIntEntry (evaluatedIdx)) if values.size > evaluatedIdx => Some (values(evaluatedIdx.toInt), None )
141141 }
142142 }
@@ -184,7 +184,7 @@ class CounterexampleParser(fp: FastParser) {
184184case class ExpectedCounterexample (exprs : Seq [PExp ]) {
185185 assert(exprs.forall {
186186 case _ : PAccPred => true
187- case PBinExp (_, " == " , _) => true
187+ case PBinExp (_, r , _) if r.rs == PSymOp . EqEq => true
188188 case _ => false
189189 })
190190}
0 commit comments