From 780f3cc80cadf87ecfdb702ef90fcb606f2783fd Mon Sep 17 00:00:00 2001 From: JSDurand Date: Sun, 16 Jul 2023 18:06:18 +0800 Subject: Fix the bug of forgetting to check cloned nodes. In the process of splitting, cloning, and planting the forest, I forgot to check whether some cloned node of the node inquestion satisfy the condition. This used to cause forests that violate some fundamental assumptions. Now this is supposed to be fixed, but more tests await us. --- chain/src/item/genins.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'chain/src/item/genins.rs') diff --git a/chain/src/item/genins.rs b/chain/src/item/genins.rs index ce34df9..ac521cc 100644 --- a/chain/src/item/genins.rs +++ b/chain/src/item/genins.rs @@ -213,7 +213,7 @@ impl DefaultForest> { // operation for debugging purposes. let mut to_print = true; - if std::fs::metadata(format!("output/")).is_err() { + if std::fs::metadata("output/").is_err() { to_print = false; } @@ -578,8 +578,15 @@ impl DefaultForest> { let mut result = None; + // dbg!(leaf_label, &fragment); + + // crate::item::default::print_labels(atom, fragment).unwrap(); + + // dbg!(self.vertex_label(node)?); + for (index, child) in self.children_of(node)?.enumerate() { - if matches!(self.vertex_label(child)?, Some(child_label) if child_label == leaf_label) + // dbg!(self.vertex_label(child)?, child); + if matches!(self.vertex_label(child)?, Some(child_label) if child_label.label() == leaf_label.label()) { result = Some((index, child)); break; -- cgit v1.2.3-18-g5258