recognize [] as equivalent to "" in unify_atom (#1288)

This commit is contained in:
Mark Thom
2022-02-22 23:45:04 -07:00
parent 1b91663244
commit d92d8bce89
2 changed files with 5 additions and 1 deletions

View File

@@ -544,6 +544,9 @@ impl MachineState {
(HeapCellValueTag::Atom, (name, arity)) => {
self.fail = !(arity == 0 && name == atom);
}
(HeapCellValueTag::CStr, cstr_atom) if atom == atom!("[]") => {
self.fail = cstr_atom != atom!("");
}
(HeapCellValueTag::Char, c1) => {
if let Some(c2) = atom.as_char() {
self.fail = c1 != c2;

View File

@@ -2494,9 +2494,10 @@ impl Machine {
}
};
let output = self.machine_st.store(self.machine_st.deref(self.machine_st.registers[3]));
let atom = self.machine_st.atom_tbl.build_with(&string);
self.machine_st.unify_complete_string(atom, self.machine_st.store(self.machine_st.deref(self.machine_st.registers[3])));
self.machine_st.unify_complete_string(atom, output);
Ok(())
}