match self.detect_cycles(usize::max_value(), sorted.clone()) {
CycleSearchResult::NotList if !sorted.is_ref() =>
- Err(self.error_form(self.type_error(ValidType::List, sorted))),
+ Err(self.error_form(self.type_error(ValidType::List, sorted))),
_ => Ok(())
}
}
},
Addr::HeapCell(_) | Addr::StackCell(..) =>
Err(self.error_form(self.instantiation_error())),
- addr =>
- Err(self.error_form(self.type_error(ValidType::List, addr)))
+ Addr::Con(Constant::EmptyList) =>
+ Ok(vec![]),
+ _ =>
+ Err(self.error_form(self.type_error(ValidType::List, a1)))
}
}
},
HeapCellValue::Addr(Addr::Con(Constant::EmptyList)) =>
return CycleSearchResult::ProperList(steps),
- _ => return CycleSearchResult::PartialList(steps, hare)
+ HeapCellValue::Addr(Addr::HeapCell(_)) | HeapCellValue::Addr(Addr::StackCell(..)) =>
+ return CycleSearchResult::PartialList(steps, hare),
+ _ =>
+ return CycleSearchResult::NotList
}
}
}