From ffeb4b8e73a98dd7779152d3028091803049c09e Mon Sep 17 00:00:00 2001 From: Michael Sippel Date: Tue, 6 Aug 2024 15:40:05 +0200 Subject: [PATCH] repr tree: create new VecBuffer in case attach_to() is called on Vec --- lib-nested-core/src/repr_tree/node.rs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/lib-nested-core/src/repr_tree/node.rs b/lib-nested-core/src/repr_tree/node.rs index 89dadf0..6cb0e2a 100644 --- a/lib-nested-core/src/repr_tree/node.rs +++ b/lib-nested-core/src/repr_tree/node.rs @@ -187,7 +187,21 @@ impl ReprTree { if let Some(leaf) = self.leaf.as_mut() { leaf.attach_to(src_port); } else { - self.leaf = Some(ReprLeaf::from_view(src_port)); + if self.type_tag == TypeTerm::App(vec![ + TypeTerm::TypeID(TypeID::Fun(11)), + TypeTerm::TypeID(TypeID::Fun(2)) + ]) { + let mut leaf = ReprLeaf::from_vec_buffer( + VecBuffer::< + Arc> + >::new() + ); + + leaf.attach_to(src_port); + self.leaf = Some(leaf); + } else { + self.leaf = Some(ReprLeaf::from_view(src_port)); + } } }