Skip to content

Commit

Permalink
Pass over everthing that contained location
Browse files Browse the repository at this point in the history
  • Loading branch information
sakehl committed Jan 10, 2024
1 parent 2041586 commit 9fcc7a6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
8 changes: 8 additions & 0 deletions src/rewrite/vct/rewrite/InlineApplicables.scala
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,14 @@ case class InlineApplicables[Pre <: Generation]() extends Rewriter[Pre] with Laz
case Perm(loc @ InstancePredicateLocation(pred, obj, args), WritePerm()) if pred.decl.inline =>
dispatch(InstancePredicateApply(obj, pred, args, WritePerm()(loc.o))(loc.o))

case Perm(InLinePatternLocation(loc @ PredicateLocation(pred, args), pat), WritePerm()) if pred.decl.inline =>
dispatch(PredicateApply(pred, args, WritePerm()(loc.o))(loc.o))
// TODO: Or should I do:
// dispatch(InlinePattern(PredicateApply(pred, args, WritePerm()(loc.o))(loc.o))(loc.o))

case Perm(InLinePatternLocation(loc @ InstancePredicateLocation(pred, obj, args), pat), WritePerm()) if pred.decl.inline =>
dispatch(InstancePredicateApply(obj, pred, args, WritePerm()(loc.o))(loc.o))

case other => rewriteDefault(other)
}
}
6 changes: 3 additions & 3 deletions src/rewrite/vct/rewrite/SimplifyNestedQuantifiers.scala
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ case class SimplifyNestedQuantifiers[Pre <: Generation]() extends Rewriter[Pre]
case None =>
val res = rewriteDefault(e)
res match {
case Starall(_, Nil, body) if !body.exists { case InlinePattern(_, _, _) => true } =>
case Starall(_, Nil, body) if !body.exists { case InlinePattern(_, _, _) | InLinePatternLocation(_, _) => true} =>
logger.warn(f"The binder `${e.toInlineString}` contains no triggers")
case Forall(_, Nil, body) if !body.exists { case InlinePattern(_, _, _) => true } =>
case Forall(_, Nil, body) if !body.exists { case InlinePattern(_, _, _) | InLinePatternLocation(_, _) => true } =>
logger.warn(f"The binder `${e.toInlineString}` contains no triggers")
case _ =>
}
Expand Down Expand Up @@ -150,7 +150,7 @@ case class SimplifyNestedQuantifiers[Pre <: Generation]() extends Rewriter[Pre]
if (e.bindings.exists(_.t != TInt())) return None

// PB: do not attempt to reshape quantifiers that already have patterns
if (originalBody.exists { case _: InlinePattern[Pre] => true }) {
if (originalBody.exists { case InlinePattern(_, _, _) | InLinePatternLocation(_, _) => true }) {
logger.debug(s"Not rewriting $e because it contains patterns")
return None
}
Expand Down

0 comments on commit 9fcc7a6

Please sign in to comment.