Skip to content

Commit 3d3f8e1

Browse files
committed
evaluate spec rules with requires constraints when initializing
1 parent 208f36f commit 3d3f8e1

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

java-backend/src/main/java/org/kframework/backend/java/symbolic/InitializeRewriter.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -322,8 +322,8 @@ public ProcessProofRules invoke(GlobalContext rewritingContext, long initCounter
322322
.map(r -> converter.convert(Optional.<Module>empty(), r))
323323
.map(r -> new org.kframework.backend.java.kil.Rule(
324324
r.label(),
325-
r.leftHandSide().evaluate(termContext),
326-
r.rightHandSide().evaluate(termContext),
325+
evaluate(r.leftHandSide(), r.getRequires(), termContext),
326+
evaluate(r.rightHandSide(), r.getRequires(), termContext),
327327
r.requires(),
328328
r.ensures(),
329329
r.freshConstants(),
@@ -334,6 +334,13 @@ public ProcessProofRules invoke(GlobalContext rewritingContext, long initCounter
334334
.collect(Collectors.toList());
335335
return this;
336336
}
337+
338+
private Term evaluate(Term term, ConjunctiveFormula constraint, TermContext context) {
339+
context.setTopConstraint(constraint);
340+
Term newTerm = term.evaluate(context);
341+
context.setTopConstraint(null);
342+
return newTerm;
343+
}
337344
}
338345
}
339346

0 commit comments

Comments
 (0)