unify '[]' with proper [] in atom_chars/2 (#569)

This commit is contained in:
Mark Thom
2020-08-03 19:29:53 -06:00
parent 4f15802fbc
commit d57a592273
3 changed files with 17 additions and 13 deletions

View File

@@ -1029,20 +1029,24 @@ impl MachineState {
match iter.focus() {
Addr::EmptyList => {
let chars = clause_name!(string, indices.atom_tbl);
let atom = self.heap.to_unifiable(
HeapCellValue::Atom(chars, None)
);
if &string == "[]" {
self.unify(addr, Addr::EmptyList);
} else {
let chars = clause_name!(string, indices.atom_tbl);
let atom = self.heap.to_unifiable(
HeapCellValue::Atom(chars, None)
);
self.unify(addr, atom);
self.unify(addr, atom);
}
}
focus => {
let stub = MachineError::functor_stub(
clause_name!("atom_chars"),
2,
);
if let Addr::Lis(l) = focus {
let stub = MachineError::functor_stub(
clause_name!("atom_chars"),
2,
);
let err = MachineError::type_error(
self.heap.h(),
ValidType::Character,