compare '[]' in pstr_comparator of compare_term_test (#1299)

This commit is contained in:
Mark Thom
2022-02-25 23:57:27 -07:00
parent 26e4560429
commit d55d5f15ae

View File

@@ -1641,8 +1641,8 @@ impl MachineState {
PStrCmpResult::Ordered(ordering) => Some(ordering), PStrCmpResult::Ordered(ordering) => Some(ordering),
_ => { _ => {
if iter1.num_steps() == 0 && iter2.num_steps() == 0 { if iter1.num_steps() == 0 && iter2.num_steps() == 0 {
return match iter2.focus.get_tag() { return read_heap_cell!(iter2.focus,
HeapCellValueTag::CStr | HeapCellValueTag::PStrLoc => { (HeapCellValueTag::CStr | HeapCellValueTag::PStrLoc) => {
let result = stalled_pstr_iter_handler(iter2, iter1, pdl); let result = stalled_pstr_iter_handler(iter2, iter1, pdl);
if let Some(ordering) = result { if let Some(ordering) = result {
@@ -1653,10 +1653,17 @@ impl MachineState {
result result
} }
} }
(HeapCellValueTag::Atom, (name, arity)) => {
if name == atom!("[]") && arity == 0 {
return Some(Ordering::Greater);
} else {
stalled_pstr_iter_handler(iter1, iter2, pdl)
}
}
_ => { _ => {
stalled_pstr_iter_handler(iter1, iter2, pdl) stalled_pstr_iter_handler(iter1, iter2, pdl)
} }
}; );
} }
pdl.push(iter2.focus); pdl.push(iter2.focus);