Skip to content

Commit 8004380

Browse files
committed
Add let case in ChooseEncoder
1 parent c37411d commit 8004380

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

src/main/scala/inox/solvers/unrolling/ChooseEncoder.scala

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ trait ChooseEncoder extends transformers.ProgramTransformer {
2525

2626
val newFds = sourceProgram.symbols.functions.values.toList.map { fd =>
2727
def rec(e: Expr, params: Seq[ValDef]): Expr = e match {
28+
case l: Let =>
29+
val free = exprOps.variablesOf(l)
30+
l.copy(body = rec(l.body, params.filter(vd => free(vd.toVariable)) :+ l.vd)).copiedFrom(l)
31+
2832
case l: Lambda =>
2933
val free = exprOps.variablesOf(l)
3034
l.copy(body = rec(l.body, params.filter(vd => free(vd.toVariable)) ++ l.params)).copiedFrom(l)

src/main/scala/inox/solvers/unrolling/UnrollingSolver.scala

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,15 @@ trait AbstractUnrollingSolver extends Solver { self =>
164164

165165
def assertCnstr(expression: Expr): Unit = context.timers.solvers.assert.run(try {
166166
context.timers.solvers.assert.sanity.run {
167-
symbols.ensureWellFormed // make sure that the current program is well-formed
168-
typeCheck(expression, BooleanType()) // make sure we've asserted a boolean-typed expression
167+
try {
168+
symbols.ensureWellFormed // make sure that the current program is well-formed
169+
typeCheck(expression, BooleanType()) // make sure we've asserted a boolean-typed expression
170+
} catch {
171+
case _: Throwable =>
172+
context.reporter.internalError(
173+
"Error while ensuring well-formedness of symbols and expression in `assertCnstr` in `UnrollingSolver`"
174+
)
175+
}
169176
}
170177

171178
// Multiple calls to registerForInterrupts are (almost) idempotent and acceptable

0 commit comments

Comments
 (0)