Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/line_list_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2637,12 +2637,12 @@ impl<V: Clone + Send + Sync, A: Allocator> TrieNode<V, A> for LineListNode<V, A>
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),
Expand Down
21 changes: 21 additions & 0 deletions src/zipper_head.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Vec<u8>> = 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()]);
}
}