@@ -367,8 +367,7 @@ mod test {
367367 use std:: sync:: Arc ;
368368
369369 use hugr_core:: builder:: {
370- BuildError , DFGBuilder , Dataflow , DataflowHugr , DataflowSubContainer , HugrBuilder ,
371- inout_sig,
370+ inout_sig, BuildError , DFGBuilder , Dataflow , DataflowHugr , DataflowSubContainer , FunctionBuilder , HugrBuilder
372371 } ;
373372
374373 use hugr_core:: extension:: prelude:: { option_type, usize_t} ;
@@ -798,9 +797,9 @@ mod test {
798797 let lin_t: Type = lin_ct. clone ( ) . into ( ) ;
799798
800799 // A simple Hugr that discards a usize_t, with a "drop" function
801- let mut dfb = DFGBuilder :: new ( inout_sig ( usize_t ( ) , type_row ! [ ] ) ) . unwrap ( ) ;
800+ let mut fb = FunctionBuilder :: new ( "main" , inout_sig ( usize_t ( ) , type_row ! [ ] ) ) . unwrap ( ) ;
802801 let discard_fn = {
803- let mut mb = dfb . module_root_builder ( ) ;
802+ let mut mb = fb . module_root_builder ( ) ;
804803 let mut fb = mb
805804 . define_function ( "drop" , Signature :: new ( lin_t. clone ( ) , type_row ! [ ] ) )
806805 . unwrap ( ) ;
@@ -813,7 +812,7 @@ mod test {
813812 fb. finish_with_outputs ( [ ] ) . unwrap ( )
814813 }
815814 . node ( ) ;
816- let backup = dfb . finish_hugr ( ) . unwrap ( ) ;
815+ let backup = fb . finish_hugr ( ) . unwrap ( ) ;
817816
818817 let mut lower_discard_to_call = ReplaceTypes :: default ( ) ;
819818 // The `copy_fn` here is just any random node, we don't use it
@@ -842,16 +841,15 @@ mod test {
842841 ) ;
843842 let r = lower_discard_to_call. run ( & mut backup. clone ( ) ) ;
844843 // Note the error (or success) can be quite fragile, according to what the `discard_fn`
845- // Node points at in the (hidden here) inner Hugr inside the Value::Function built by
846- // the array linearization helper.
844+ // Node points at in the (hidden here) inner Hugr built by the array linearization helper.
847845 assert ! ( matches!(
848846 r,
849847 Err ( ReplaceTypesError :: LinearizeError (
850848 LinearizeError :: NestedTemplateError (
851849 nested_t,
852- BuildError :: NodeNotFound { node } // Note `..` would be somewhat less fragile
850+ BuildError :: UnexpectedType { .. } // Note `..` would be somewhat less fragile
853851 )
854- ) ) if nested_t == lin_t && node == discard_fn
852+ ) ) if nested_t == lin_t
855853 ) ) ;
856854 }
857855}
0 commit comments