Skip to content

Commit e742b1d

Browse files
committed
Store Derivation Nodes in State Refinement Errors
1 parent 0d6f57b commit e742b1d

3 files changed

Lines changed: 15 additions & 15 deletions

File tree

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package liquidjava.diagnostics.errors;
22

33
import liquidjava.diagnostics.TranslationTable;
4-
import liquidjava.rj_language.ast.Expression;
4+
import liquidjava.rj_language.opt.derivation_node.ValDerivationNode;
55
import spoon.reflect.cu.SourcePosition;
66

77
/**
@@ -11,23 +11,23 @@
1111
*/
1212
public class StateRefinementError extends LJError {
1313

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

17-
public StateRefinementError(SourcePosition position, Expression expected, Expression found,
17+
public StateRefinementError(SourcePosition position, ValDerivationNode expected, ValDerivationNode found,
1818
TranslationTable translationTable, String customMessage) {
19-
super("State Refinement Error",
20-
String.format("Expected state %s but found %s", expected.toDisplayString(), found.toDisplayString()),
21-
position, translationTable, customMessage);
22-
this.expected = expected.toDisplayString();
23-
this.found = found.toDisplayString();
19+
super("State Refinement Error", String.format("Expected state %s but found %s",
20+
expected.getValue().toDisplayString(), found.getValue().toDisplayString()), position, translationTable,
21+
customMessage);
22+
this.expected = expected;
23+
this.found = found;
2424
}
2525

26-
public String getExpected() {
26+
public ValDerivationNode getExpected() {
2727
return expected;
2828
}
2929

30-
public String getFound() {
30+
public ValDerivationNode getFound() {
3131
return found;
3232
}
3333
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ public <R> void visitCtMethod(CtMethod<R> method) {
7575
String signature = method.getSignature();
7676
String message = String.format("Could not find constructor '%s' for '%s'", signature, prefix);
7777
String[] overloads = getOverloads(targetType, method);
78-
diagnostics.add(new ExternalMethodNotFoundWarning(method.getPosition(), message, signature,
79-
prefix, overloads));
78+
diagnostics.add(
79+
new ExternalMethodNotFoundWarning(method.getPosition(), message, signature, prefix, overloads));
8080
}
8181
} else {
8282
if (!methodExists(targetType, method)) {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -391,8 +391,8 @@ protected void throwStateRefinementError(SourcePosition position, Predicate foun
391391
gatherVariables(found, lrv, mainVars);
392392
TranslationTable map = new TranslationTable();
393393
VCImplication foundState = joinPredicates(found, mainVars, lrv, map);
394-
throw new StateRefinementError(position, expected.getExpression(),
395-
foundState.toConjunctions().simplify(context).getValue(), map, customMessage);
394+
throw new StateRefinementError(position, expected.simplify(context),
395+
foundState.toConjunctions().simplify(context), map, customMessage);
396396
}
397397

398398
protected void throwStateConflictError(SourcePosition position, Predicate expected) throws StateConflictError {

0 commit comments

Comments
 (0)