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

4
Cargo.lock generated
View File

@@ -905,9 +905,9 @@ dependencies = [
[[package]]
name = "prolog_parser"
version = "0.8.65"
version = "0.8.66"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fdcfe8260335a150812e36b171ff985ce88f02de16c05f4a13fe4f10e8c247f8"
checksum = "e35f5db0eb6725d00be12f3c9550de0dce0a43a1fa25a873f879613d63fcbbd5"
dependencies = [
"lexical",
"num-rug-adapter",

View File

@@ -32,7 +32,7 @@ libc = "0.2.62"
nix = "0.15.0"
num-rug-adapter = { optional = true, version = "0.1.3" }
ordered-float = "0.5.0"
prolog_parser = { version = "0.8.65", default-features = false }
prolog_parser = { version = "0.8.66", default-features = false }
ref_thread_local = "0.0.0"
rug = { version = "1.4.0", optional = true }
rustyline = "6.0.0"

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,