diff --git a/src/line_list_node.rs b/src/line_list_node.rs index 9607b440..d9333f80 100644 --- a/src/line_list_node.rs +++ b/src/line_list_node.rs @@ -2637,12 +2637,12 @@ impl TrieNode for LineListNode unimplemented!() }, CELL_BYTE_NODE_TAG => { - let other_dense_node = unsafe{ other.as_dense_unchecked() }; - let mut new_node = other_dense_node.clone(); + let other_cell_node = unsafe{ other.as_cell_unchecked() }; + let mut new_node = other_cell_node.clone(); match new_node.merge_from_list_node(self) { //See the DENSE_BYTE_NODE_TAG arm: two empty nodes join to an empty result AlgebraicStatus::None => { - debug_assert!(self.node_is_empty() && other_dense_node.node_is_empty()); + debug_assert!(self.node_is_empty() && other_cell_node.node_is_empty()); AlgebraicResult::None }, AlgebraicStatus::Identity => AlgebraicResult::Identity(COUNTER_IDENT), diff --git a/src/zipper_head.rs b/src/zipper_head.rs index 1ab41673..cab1cfa9 100644 --- a/src/zipper_head.rs +++ b/src/zipper_head.rs @@ -1494,4 +1494,25 @@ mod tests { assert_eq!(rz.is_val(), false); drop(rz); } + + /// A ZipperHead turns the parent node into a CellByteNode; joining a list node with it must not + /// treat the cell node as a DenseByteNode + #[test] + fn zipper_head_cell_node_pjoin_test() { + let mut b = PathMap::<()>::new(); + b.set_val_at(b"ax", ()); + b.set_val_at(b"bx", ()); + { + let zh = b.zipper_head(); + let mut wz = zh.write_zipper_at_exclusive_path(b"c").unwrap(); + wz.set_val(()); + } + let mut a = PathMap::<()>::new(); + a.set_val_at(b"dx", ()); + + let joined = a.join(&b); + let mut paths: Vec> = joined.iter().map(|(p, _)| p).collect(); + paths.sort(); + assert_eq!(paths, vec![b"ax".to_vec(), b"bx".to_vec(), b"c".to_vec(), b"dx".to_vec()]); + } }