list_loc_as_cell!(1)
);
assert_eq!(iter.next().unwrap(), cyclic_link);
-
assert_eq!(iter.next().unwrap(), cyclic_link);
-
assert_eq!(iter.next().unwrap(), cyclic_link);
assert_eq!(iter.next(), None);
var_opt => {
if is_cyclic && cell.is_compound(self.iter.heap) {
// self-referential variables are marked "cyclic".
+ read_heap_cell!(cell,
+ (HeapCellValueTag::Lis, vh) => {
+ if self.iter.heap[vh].get_forwarding_bit() {
+ self.iter.pop_stack();
+ }
+
+ if self.iter.heap[vh+1].get_forwarding_bit() {
+ self.iter.pop_stack();
+ }
+ }
+ _ => {}
+ );
+
match var_opt {
Some(var) => {
// If the term is bound to a named variable,
None => return None,
};
+ if self.cycle_detection_active() {
+ for idx in (self.next as usize .. last_cell_loc).rev() {
+ if self.heap[idx].get_forwarding_bit() {
+ self.cycle_found = true;
+ return None;
+ }
+ }
+ }
+
if (last_cell_loc + 1) as u64 == self.next {
if self.backward() {
return None;
self.heap[last_cell_loc].set_mark_bit(self.mark_phase);
}
- if self.cycle_detection_active() {
- for idx in (self.next as usize .. last_cell_loc).rev() {
- if self.heap[idx].get_forwarding_bit() {
- self.cycle_found = true;
- return None;
- }
- }
- }
-
self.heap[last_cell_loc].set_forwarding_bit(true);
self.next = self.heap[last_cell_loc].get_value();
\+ acyclic_term(T)
)).
+test("acyclic_term#2131", (
+ A=[B],C=[B],C=[A],
+ \+ acyclic_term(C)
+)).
+
main :-
findall(test(Name, Goal), test(Name, Goal), Tests),
run_tests(Tests, Failed),