|
6 | 6 |
|
7 | 7 | import liquidjava.api.CommandLineLauncher; |
8 | 8 | import liquidjava.diagnostics.TranslationTable; |
9 | | -import liquidjava.rj_language.ast.Var; |
| 9 | +import liquidjava.rj_language.ast.Expression; |
10 | 10 | import liquidjava.rj_language.ast.formatter.VariableFormatter; |
11 | 11 | import liquidjava.rj_language.opt.derivation_node.ValDerivationNode; |
12 | 12 | import liquidjava.smt.Counterexample; |
@@ -46,16 +46,17 @@ public String getCounterExampleString() { |
46 | 46 |
|
47 | 47 | List<String> foundVarNames = new ArrayList<>(); |
48 | 48 | found.getValue().getVariableNames(foundVarNames); |
| 49 | + List<String> foundAssignments = found.getValue().getConjuncts().stream().map(Expression::toString).toList(); |
49 | 50 | String counterexampleString = counterexample.assignments().stream() |
50 | | - // only include variables that appear in the found value |
51 | | - .filter(a -> CommandLineLauncher.cmdArgs.debugMode || foundVarNames.contains(a.first())) |
| 51 | + // only include variables that appear in the found value and are not already fixed there |
| 52 | + .filter(a -> CommandLineLauncher.cmdArgs.debugMode || (foundVarNames.contains(a.first()) |
| 53 | + && !foundAssignments.contains(a.first() + " == " + a.second()))) |
52 | 54 | // format as "var == value" |
53 | 55 | .map(a -> VariableFormatter.format(a.first()) + " == " + a.second()) |
54 | 56 | // join with "&&" |
55 | 57 | .collect(Collectors.joining(" && ")); |
56 | 58 |
|
57 | | - String foundString = found.getValue().toDisplayString(); |
58 | | - if (counterexampleString.isEmpty() || counterexampleString.equals(foundString)) |
| 59 | + if (counterexampleString.isEmpty()) |
59 | 60 | return null; |
60 | 61 |
|
61 | 62 | return counterexampleString; |
|
0 commit comments