Skip to content

Commit

Permalink
[PCover] Minor correction
Browse files Browse the repository at this point in the history
Correct support for choosing over lists with elements as composites
  • Loading branch information
aman-goel committed Oct 7, 2023
1 parent 7f27a8c commit 95ee194
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -246,11 +246,17 @@ public ValueSummary getNextElementFlattener(PrimitiveVS<ValueSummary> choices) {
return flattened;
}

protected abstract ValueSummary getNextPrimitiveList(ListVS<? extends ValueSummary> s, Guard pc);

@Override
public ValueSummary getNextElement(ListVS<? extends ValueSummary> s, Guard pc) {
// PrimitiveVS<Integer> idx = getNextInteger(s.size(), pc);
// return s.get(idx);
return getNextElementFlattener(getNextElementHelper(getNextElementChoices(s, pc)));
if (s.getItems().size() != 0) {
if (!(s.getItems().get(0) instanceof PrimitiveVS)) {
PrimitiveVS<Integer> idx = getNextInteger(s.size(), pc);
return s.get(idx);
}
}
return getNextPrimitiveList(s, pc);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ public PrimitiveVS<Integer> getNextInteger(PrimitiveVS<Integer> bound, Guard pc)
}

@Override
public ValueSummary getNextElement(ListVS<? extends ValueSummary> candidates, Guard pc) {
public ValueSummary getNextPrimitiveList(ListVS<? extends ValueSummary> candidates, Guard pc) {
ValueSummary res = getNextElementFlattener(schedule.getRepeatElement(choiceDepth));
List<GuardedValue<?>> gv = ValueSummary.getGuardedValues(res);
assert (gv.size() == 1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,7 @@ public PrimitiveVS<Integer> getNextInteger(PrimitiveVS<Integer> bound, Guard pc)
}

@Override
public ValueSummary getNextElement(ListVS<? extends ValueSummary> candidates, Guard pc) {
public ValueSummary getNextPrimitiveList(ListVS<? extends ValueSummary> candidates, Guard pc) {
int depth = choiceDepth;
PrimitiveVS<ValueSummary> res =
getNext(
Expand Down

0 comments on commit 95ee194

Please sign in to comment.