summaryrefslogtreecommitdiff
path: root/chain/src/item/default/splone.rs
diff options
context:
space:
mode:
authorJSDurand <mmemmew@gmail.com>2023-02-12 15:49:28 +0800
committerJSDurand <mmemmew@gmail.com>2023-02-12 15:49:28 +0800
commit68d3baa1346aec734f4f98a3044c0056694f1b76 (patch)
treef5f7e114c6bdf848d7cdd77c319f1d379d82b847 /chain/src/item/default/splone.rs
parent987c84f3454c687cca0efe0d471fcf00e052ecab (diff)
fix clone not changing the root
Previously cloning a node does not alter the root of the forest, while it should alter the root if the cloned node was the root. This would affect how we compare the equalities of forests. It indeed resulted in anomalies that were hard to solve.
Diffstat (limited to 'chain/src/item/default/splone.rs')
-rw-r--r--chain/src/item/default/splone.rs13
1 files changed, 7 insertions, 6 deletions
diff --git a/chain/src/item/default/splone.rs b/chain/src/item/default/splone.rs
index 1168539..4f4835b 100644
--- a/chain/src/item/default/splone.rs
+++ b/chain/src/item/default/splone.rs
@@ -1,3 +1,4 @@
+#![allow(dead_code)]
//! This module implements a function for "closing" and "splitting" a
//! node in a forest, and hence the name.
@@ -595,6 +596,12 @@ mod test_splone {
forest.plant(
cloned,
+ leaf!(GrammarLabel::new_closed(6, 0, 1), GrammarLabel),
+ true,
+ )?;
+
+ forest.plant(
+ cloned,
leaf!(GrammarLabel::new_closed(7, 1, 3), GrammarLabel),
false,
)?;
@@ -605,12 +612,6 @@ mod test_splone {
false,
)?;
- forest.plant(
- cloned,
- leaf!(GrammarLabel::new_closed(6, 0, 1), GrammarLabel),
- true,
- )?;
-
let mut builder = PLGBuilderMut::from_graph_mut(&mut forest.graph);
let dummy_label = ForestLabel::from(GrammarLabel::new(0, 0));