Skip to content

Commit 9761ced

Browse files
committed
Use DerivationNodes in Expected of Refinement Error
1 parent 08af804 commit 9761ced

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

liquidjava-verifier/src/main/java/liquidjava/diagnostics/errors/RefinementError.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,19 @@
1212
*/
1313
public class RefinementError extends LJError {
1414

15-
private final String expected;
15+
private final ValDerivationNode expected;
1616
private final ValDerivationNode found;
1717

18-
public RefinementError(SourcePosition position, Expression expected, ValDerivationNode found,
18+
public RefinementError(SourcePosition position, ValDerivationNode expected, ValDerivationNode found,
1919
TranslationTable translationTable) {
2020
super("Refinement Error",
21-
String.format("%s is not a subtype of %s", found.getValue(), expected.toSimplifiedString()), position,
21+
String.format("%s is not a subtype of %s", found.getValue(), expected.getValue()), position,
2222
translationTable);
23-
this.expected = expected.toSimplifiedString();
23+
this.expected = expected;
2424
this.found = found;
2525
}
2626

27-
public String getExpected() {
27+
public ValDerivationNode getExpected() {
2828
return expected;
2929
}
3030

liquidjava-verifier/src/main/java/liquidjava/processor/refinement_checker/VCChecker.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public void processSubtyping(Predicate expectedType, List<GhostState> list, CtEl
5151
premises = premisesBeforeChange.changeStatesToRefinements(filtered, s).changeAliasToRefinement(context, f);
5252
et = expectedType.changeStatesToRefinements(filtered, s).changeAliasToRefinement(context, f);
5353
} catch (Exception e) {
54-
throw new RefinementError(element.getPosition(), expectedType.getExpression(), premises.simplify(), map);
54+
throw new RefinementError(element.getPosition(), expectedType.simplify(), premises.simplify(), map);
5555
}
5656

5757
try {
@@ -267,7 +267,7 @@ private TranslationTable createMap(Predicate expectedType) {
267267
protected void raiseError(Exception e, SourcePosition position, Predicate found, Predicate expected,
268268
TranslationTable map) throws LJError {
269269
if (e instanceof TypeCheckError) {
270-
throw new RefinementError(position, expected.getExpression(), found.simplify(), map);
270+
throw new RefinementError(position, expected.simplify(), found.simplify(), map);
271271
} else if (e instanceof liquidjava.smt.errors.NotFoundError nfe) {
272272
throw new NotFoundError(position, e.getMessage(), nfe.getName(), nfe.getKind(), map);
273273
} else {
@@ -288,7 +288,7 @@ protected void raiseSubtypingError(SourcePosition position, Predicate expected,
288288
gatherVariables(found, lrv, mainVars);
289289
TranslationTable map = new TranslationTable();
290290
Predicate premises = joinPredicates(expected, mainVars, lrv, map).toConjunctions();
291-
throw new RefinementError(position, expected.getExpression(), premises.simplify(), map);
291+
throw new RefinementError(position, expected.simplify(), premises.simplify(), map);
292292
}
293293

294294
protected void raiseSameStateError(SourcePosition position, Predicate expected, String klass) throws LJError {

0 commit comments

Comments
 (0)