Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,12 @@ trait ExpTransformer extends ProgramManager with ErrorReporter {
case Unfolding(acc, unfBody) =>
val permCheck = transformExp(acc.perm, c, false)
val unfoldBody = transformExp(unfBody, c, inhaleExp)
// only unfold and fold if body contains something
val (unfold, fold) = (Unfold(acc)(), Fold(acc)())

val stmts = Seq(permCheck, unfold, unfoldBody, fold)
Seqn(stmts, Nil)()
val unfold = Unfold(acc)()
val nonDetVarDecl = LocalVarDecl(uniqueName("b"), Bool)(e.pos, e.info, e.errT)
val assumeFalse = Inhale(FalseLit()())()
val thenBranch = Seqn(Seq(permCheck, unfold, unfoldBody, assumeFalse), Nil)()
val elseBranch = if (inhaleExp) Seqn(Seq(Inhale(e)(e.pos, e.info)), Nil)() else EmptyStmt
Seqn(Seq(If(nonDetVarDecl.localVar, thenBranch, elseBranch)()), Seq(nonDetVarDecl))()
case Applying(wand, body) =>
// note that this case is untested -- it's not possible to write a function with an `applying` expression
val nonDetVarDecl = LocalVarDecl(uniqueName("b"), Bool)(e.pos, e.info, e.errT)
Expand Down