From 9cefb3338852d9cbf36bba473150d5fb8cc13b4c Mon Sep 17 00:00:00 2001 From: Mark Thom Date: Tue, 8 Mar 2022 22:00:12 -0700 Subject: [PATCH] correct loading of variable name strings in write_term/3 --- src/machine/machine_state.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/machine/machine_state.rs b/src/machine/machine_state.rs index 5b859fa9..a6b375b6 100644 --- a/src/machine/machine_state.rs +++ b/src/machine/machine_state.rs @@ -641,7 +641,18 @@ impl MachineState { continue; } - var_names.insert(var, Rc::new(cell_as_atom!(atom).as_str().to_owned())); + read_heap_cell!(atom, + (HeapCellValueTag::Char, c) => { + var_names.insert(var, Rc::new(c.to_string())); + } + (HeapCellValueTag::Atom, (name, _arity)) => { + debug_assert_eq!(_arity, 0); + var_names.insert(var, Rc::new(name.as_str().to_owned())); + } + _ => { + unreachable!(); + } + ); } } _ => { -- 2.54.0