Skip to content

Commit 5996c67

Browse files
committed
Minor Improvements
1 parent 5ec95ec commit 5996c67

2 files changed

Lines changed: 4 additions & 7 deletions

File tree

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

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public RefinementError(SourcePosition position, Predicate expected, VCSimplifica
3838

3939
@Override
4040
public String getDetails() {
41-
if (counterexample == null)
41+
if (counterexample.isEmpty())
4242
return "";
4343

4444
String counterexampleString = counterexample.assignments().stream()
@@ -61,9 +61,6 @@ public VCSimplificationResult getFound() {
6161

6262
// Filters counterexample assignments only in found VC and sorts them in the order of its binders
6363
private Counterexample filterCounterexample(Counterexample counterexample) {
64-
if (counterexample == null || counterexample.assignments().isEmpty())
65-
return null;
66-
6764
List<String> binderNames = getFound().getBinders();
6865
Set<String> knownAssignments = getFound().getImplication().toPredicate().getExpression().getConjuncts().stream()
6966
.map(Expression::toString).collect(Collectors.toSet());
@@ -73,9 +70,6 @@ private Counterexample filterCounterexample(Counterexample counterexample) {
7370
.sorted((a, b) -> Integer.compare(binderNames.indexOf(a.first()), binderNames.indexOf(b.first())))
7471
.toList();
7572

76-
if (assignments.isEmpty())
77-
return null;
78-
7973
return new Counterexample(assignments);
8074
}
8175
}

liquidjava-verifier/src/main/java/liquidjava/smt/Counterexample.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,7 @@
55
import liquidjava.utils.Pair;
66

77
public record Counterexample(List<Pair<String, String>> assignments) {
8+
public boolean isEmpty() {
9+
return assignments.isEmpty();
10+
}
811
}

0 commit comments

Comments
 (0)