From 7b70f004ddbeefb40ba2514bcd32d0810d139e07 Mon Sep 17 00:00:00 2001 From: Alan Lawrence Date: Mon, 24 Jun 2024 17:29:32 +0100 Subject: [PATCH] DFGBuilder::new(_fn=>) --- hugr-core/src/builder/dataflow.rs | 2 +- hugr-core/src/hugr/rewrite/inline_dfg.rs | 2 +- hugr-core/src/hugr/serialize/test.rs | 2 +- hugr-core/src/hugr/validate/test.rs | 2 +- hugr-core/src/hugr/views/tests.rs | 2 +- hugr-core/src/ops/constant.rs | 2 +- hugr-passes/src/const_fold.rs | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/hugr-core/src/builder/dataflow.rs b/hugr-core/src/builder/dataflow.rs index 58164b0b0..e479f06d2 100644 --- a/hugr-core/src/builder/dataflow.rs +++ b/hugr-core/src/builder/dataflow.rs @@ -78,7 +78,7 @@ impl DFGBuilder { /// Begin building a new DFG-rooted HUGR given its inputs and outputs; /// extension delta will be inferred. - pub fn new_fn( + pub fn new( inputs: impl Into, outputs: impl Into, ) -> Result, BuildError> { diff --git a/hugr-core/src/hugr/rewrite/inline_dfg.rs b/hugr-core/src/hugr/rewrite/inline_dfg.rs index 8e23336f7..988c9b8ae 100644 --- a/hugr-core/src/hugr/rewrite/inline_dfg.rs +++ b/hugr-core/src/hugr/rewrite/inline_dfg.rs @@ -174,7 +174,7 @@ mod test { .unwrap(); let int_ty = &int_types::INT_TYPES[6]; - let mut outer = DFGBuilder::new_fn(vec![int_ty.clone(); 2], vec![int_ty.clone()])?; + let mut outer = DFGBuilder::new(vec![int_ty.clone(); 2], vec![int_ty.clone()])?; let [a, b] = outer.input_wires_arr(); fn make_const + AsRef>( d: &mut DFGBuilder, diff --git a/hugr-core/src/hugr/serialize/test.rs b/hugr-core/src/hugr/serialize/test.rs index f07dc51fa..5e4c9d802 100644 --- a/hugr-core/src/hugr/serialize/test.rs +++ b/hugr-core/src/hugr/serialize/test.rs @@ -351,7 +351,7 @@ fn hierarchy_order() -> Result<(), Box> { #[test] fn constants_roundtrip() -> Result<(), Box> { - let mut builder = DFGBuilder::new_fn(vec![], vec![INT_TYPES[4].clone()]).unwrap(); + let mut builder = DFGBuilder::new(vec![], vec![INT_TYPES[4].clone()]).unwrap(); let w = builder.add_load_value(ConstInt::new_s(4, -2).unwrap()); let hugr = builder.finish_hugr_with_outputs([w], &INT_OPS_REGISTRY)?; diff --git a/hugr-core/src/hugr/validate/test.rs b/hugr-core/src/hugr/validate/test.rs index d0a1e00f7..c0b424768 100644 --- a/hugr-core/src/hugr/validate/test.rs +++ b/hugr-core/src/hugr/validate/test.rs @@ -766,7 +766,7 @@ fn test_polymorphic_call() -> Result<(), Box> { let int_pair = Type::new_tuple(type_row![USIZE_T; 2]); // Root DFG: applies a function int--PRELUDE-->int to each element of a pair of two ints - let mut d = DFGBuilder::new_fn( + let mut d = DFGBuilder::new( vec![utou(PRELUDE_ID), int_pair.clone()], vec![int_pair.clone()], )?; diff --git a/hugr-core/src/hugr/views/tests.rs b/hugr-core/src/hugr/views/tests.rs index a905e5198..0526e4991 100644 --- a/hugr-core/src/hugr/views/tests.rs +++ b/hugr-core/src/hugr/views/tests.rs @@ -152,7 +152,7 @@ fn value_types() { fn static_targets() { use crate::extension::prelude::{ConstUsize, USIZE_T}; use itertools::Itertools; - let mut dfg = DFGBuilder::new_fn(type_row![], type_row![USIZE_T]).unwrap(); + let mut dfg = DFGBuilder::new(type_row![], type_row![USIZE_T]).unwrap(); let c = dfg.add_constant(Value::extension(ConstUsize::new(1))); diff --git a/hugr-core/src/ops/constant.rs b/hugr-core/src/ops/constant.rs index abd115ecf..e412e5367 100644 --- a/hugr-core/src/ops/constant.rs +++ b/hugr-core/src/ops/constant.rs @@ -492,7 +492,7 @@ mod test { let pred_rows = vec![type_row![USIZE_T, FLOAT64_TYPE], Type::EMPTY_TYPEROW]; let pred_ty = SumType::new(pred_rows.clone()); - let mut b = DFGBuilder::new_fn(type_row![], TypeRow::from(vec![pred_ty.clone().into()]))?; + let mut b = DFGBuilder::new(type_row![], TypeRow::from(vec![pred_ty.clone().into()]))?; let c = b.add_constant(Value::sum( 0, [ diff --git a/hugr-passes/src/const_fold.rs b/hugr-passes/src/const_fold.rs index 63c7f3d04..18f89a6ac 100644 --- a/hugr-passes/src/const_fold.rs +++ b/hugr-passes/src/const_fold.rs @@ -135,7 +135,7 @@ pub fn fold_leaf_op(op: &OpType, consts: &[(IncomingPort, Value)]) -> ConstFoldR /// against `reg`. fn const_graph(consts: Vec, reg: &ExtensionRegistry) -> Hugr { let const_types = consts.iter().map(Value::get_type).collect_vec(); - let mut b = DFGBuilder::new_fn(type_row![], const_types).unwrap(); + let mut b = DFGBuilder::new(type_row![], const_types).unwrap(); let outputs = consts .into_iter()