From: Mark Thom Date: Sat, 26 Feb 2022 06:57:27 +0000 (-0700) Subject: compare '[]' in pstr_comparator of compare_term_test (#1299) X-Git-Tag: v0.9.0^2~12 X-Git-Url: https://git.sagredo.dev/?a=commitdiff_plain;h=d55d5f15ae9eadffd8f73f6af5635987a740eb2d;p=scryer-prolog.git compare '[]' in pstr_comparator of compare_term_test (#1299) --- diff --git a/src/machine/machine_state_impl.rs b/src/machine/machine_state_impl.rs index 5003d14a..fc60afcc 100644 --- a/src/machine/machine_state_impl.rs +++ b/src/machine/machine_state_impl.rs @@ -1641,8 +1641,8 @@ impl MachineState { PStrCmpResult::Ordered(ordering) => Some(ordering), _ => { if iter1.num_steps() == 0 && iter2.num_steps() == 0 { - return match iter2.focus.get_tag() { - HeapCellValueTag::CStr | HeapCellValueTag::PStrLoc => { + return read_heap_cell!(iter2.focus, + (HeapCellValueTag::CStr | HeapCellValueTag::PStrLoc) => { let result = stalled_pstr_iter_handler(iter2, iter1, pdl); if let Some(ordering) = result { @@ -1653,10 +1653,17 @@ impl MachineState { 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) } - }; + ); } pdl.push(iter2.focus);