From 111335a354a788cef878b3fe36651a9287bd6750 Mon Sep 17 00:00:00 2001 From: Alan Lawrence Date: Wed, 25 Oct 2023 09:07:23 +0100 Subject: [PATCH] Fix cfg_children_restrictions test in a different way (instantiate_extensions) --- src/hugr/validate.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/hugr/validate.rs b/src/hugr/validate.rs index cea7425bd..5d55022d0 100644 --- a/src/hugr/validate.rs +++ b/src/hugr/validate.rs @@ -997,8 +997,9 @@ mod test { .map_into() .collect_tuple() .unwrap(); - let mut closure = b.infer_extensions().unwrap(); - assert!(closure.remove(©).is_some()); + let closure = b.infer_extensions().unwrap(); + b.instantiate_extensions(closure); + b.validate(&EMPTY_REG).unwrap(); b.replace_op( copy, NodeType::pure(ops::CFG { @@ -1010,7 +1011,7 @@ mod test { // (i.e. update_and_validate) on such a malformed Hugr, and pure `validate(&EMPTY_REG)` // fails because of missing extension annotations (contained in the closure) assert_matches!( - b.validate_with_extension_closure(closure, &EMPTY_REG), + b.validate(&EMPTY_REG), Err(ValidationError::ContainerWithoutChildren { .. }) ); let cfg = copy;