From 48a830ab9308837d0a7561c2e5372758833883a3 Mon Sep 17 00:00:00 2001 From: Craig Roy Date: Mon, 23 Oct 2023 14:10:01 +0100 Subject: [PATCH] fix: Generalise `add_op` extensions --- src/hugr.rs | 3 +-- src/hugr/hugrmut.rs | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/hugr.rs b/src/hugr.rs index ec44afa46..322a123c6 100644 --- a/src/hugr.rs +++ b/src/hugr.rs @@ -305,8 +305,7 @@ impl Hugr { /// Add a node to the graph, with the default conversion from OpType to NodeType pub(crate) fn add_op(&mut self, op: impl Into) -> Node { - // TODO: Default to `NodeType::open_extensions` once we can infer extensions - self.add_node(NodeType::pure(op)) + self.add_node(NodeType::open_extensions(op)) } /// Add a node to the graph. diff --git a/src/hugr/hugrmut.rs b/src/hugr/hugrmut.rs index b70d99be8..5f6c46bc8 100644 --- a/src/hugr/hugrmut.rs +++ b/src/hugr/hugrmut.rs @@ -207,7 +207,7 @@ impl + AsMut> HugrMut for T { } fn add_op_before(&mut self, sibling: Node, op: impl Into) -> Result { - let node = self.as_mut().add_node(NodeType::open_extensions(op)); + let node = self.as_mut().add_op(op); self.as_mut() .hierarchy .insert_before(node.index, sibling.index)?;