Skip to content

Commit

Permalink
Fix cfg_children_restrictions test in a different way (instantiate_ex…
Browse files Browse the repository at this point in the history
…tensions)
  • Loading branch information
acl-cqc committed Oct 25, 2023
1 parent bb79165 commit 9234154
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/hugr/validate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -997,20 +997,20 @@ mod test {
.map_into()
.collect_tuple()
.unwrap();
let mut closure = b.infer_extensions().unwrap();
assert!(closure.remove(&copy).is_some());
// Write Extension annotations into the Hugr while it's still well-formed
// enough for us to compute them
let closure = b.infer_extensions().unwrap();
b.instantiate_extensions(closure);
b.validate(&EMPTY_REG).unwrap();
b.replace_op(
copy,
NodeType::pure(ops::CFG {
signature: FunctionType::new(type_row![BOOL_T], type_row![BOOL_T]),
}),
)
.unwrap();
// We feed in the closure from above because we can't compute the closure
// (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;
Expand Down

0 comments on commit 9234154

Please sign in to comment.