Skip to content
Merged
Show file tree
Hide file tree
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
@@ -1,7 +1,7 @@
package liquidjava.diagnostics.errors;

import liquidjava.diagnostics.TranslationTable;
import liquidjava.rj_language.ast.Expression;
import liquidjava.rj_language.opt.derivation_node.ValDerivationNode;
import spoon.reflect.cu.SourcePosition;

/**
Expand All @@ -11,23 +11,23 @@
*/
public class StateRefinementError extends LJError {

private final String expected;
private final String found;
private final ValDerivationNode expected;
private final ValDerivationNode found;

public StateRefinementError(SourcePosition position, Expression expected, Expression found,
public StateRefinementError(SourcePosition position, ValDerivationNode expected, ValDerivationNode found,
TranslationTable translationTable, String customMessage) {
super("State Refinement Error",
String.format("Expected state %s but found %s", expected.toDisplayString(), found.toDisplayString()),
position, translationTable, customMessage);
this.expected = expected.toDisplayString();
this.found = found.toDisplayString();
super("State Refinement Error", String.format("Expected state %s but found %s",
expected.getValue().toDisplayString(), found.getValue().toDisplayString()), position, translationTable,
customMessage);
this.expected = expected;
this.found = found;
}

public String getExpected() {
public ValDerivationNode getExpected() {
return expected;
}

public String getFound() {
public ValDerivationNode getFound() {
return found;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ public <R> void visitCtMethod(CtMethod<R> method) {
String signature = method.getSignature();
String message = String.format("Could not find constructor '%s' for '%s'", signature, prefix);
String[] overloads = getOverloads(targetType, method);
diagnostics.add(new ExternalMethodNotFoundWarning(method.getPosition(), message, signature,
prefix, overloads));
diagnostics.add(
new ExternalMethodNotFoundWarning(method.getPosition(), message, signature, prefix, overloads));
}
} else {
if (!methodExists(targetType, method)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -391,8 +391,8 @@ protected void throwStateRefinementError(SourcePosition position, Predicate foun
gatherVariables(found, lrv, mainVars);
TranslationTable map = new TranslationTable();
VCImplication foundState = joinPredicates(found, mainVars, lrv, map);
throw new StateRefinementError(position, expected.getExpression(),
foundState.toConjunctions().simplify(context).getValue(), map, customMessage);
throw new StateRefinementError(position, expected.simplify(context),
foundState.toConjunctions().simplify(context), map, customMessage);
}

protected void throwStateConflictError(SourcePosition position, Predicate expected) throws StateConflictError {
Expand Down
Loading