From 5a5f7e5be9498af219a36401b1d2a13b553402e8 Mon Sep 17 00:00:00 2001 From: JSDurand Date: Tue, 18 Jul 2023 11:55:03 +0800 Subject: Fix a bug of unnecessarily cloning nodes. * chain/src/item/default/splone.rs: Previously when we split nodes, we always clone the parent if the labels differ. This turns out to be incorrect if the new label is open whereas the old label is closed. In that case, the old parent should not contain the new node as a child, as a closed node should not contain an open node. I am not yet entirely sure this fix is correct, so more test await us. --- chain/src/item/genins.rs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'chain/src/item/genins.rs') diff --git a/chain/src/item/genins.rs b/chain/src/item/genins.rs index ac521cc..07dbdfb 100644 --- a/chain/src/item/genins.rs +++ b/chain/src/item/genins.rs @@ -720,6 +720,12 @@ impl DefaultForest> { // return Err(Error::CannotClose(nt, t, node, node_label_start)); // } + // FIXME: It is not correct to set the end of all + // nodes unconditionally here. + // + // We need to figure out the correct way to set the + // ending positions. + for frag in reduction_fragment.into_iter().flatten() { let mut frag = frag.clone(); frag.set_pos(node_label_start, true)?; -- cgit v1.2.3-18-g5258