Skip to content

Commit

Permalink
feat: Initial support for TailLoop as circuit parent (#417)
Browse files Browse the repository at this point in the history
Co-authored-by: Agustín Borgna <[email protected]>
  • Loading branch information
doug-q and aborgna-q authored Jul 10, 2024
1 parent 030b4ff commit 5f6750b
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions tket2/src/circuit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -356,10 +356,14 @@ fn check_hugr(hugr: &impl HugrView, parent: Node) -> Result<(), CircuitError> {
},
OpType::DataflowBlock(_) => Ok(()),
OpType::Case(_) => Ok(()),
_ => Err(CircuitError::InvalidParentOp {
parent,
optype: optype.clone(),
}),
OpType::TailLoop(_) => Ok(()),
_ => {
debug_assert_eq!(None, optype.tag().partial_cmp(&OpTag::DataflowParent),);
Err(CircuitError::InvalidParentOp {
parent,
optype: optype.clone(),
})
}
}
}

Expand Down Expand Up @@ -581,6 +585,9 @@ fn update_signature(
let out_types = out_types.unwrap_or_else(|| case.signature.output().clone());
case.signature = FunctionType::new(inp_types, out_types)
}
OpType::TailLoop(_) => {
unimplemented!("TailLoop signature update")
}
_ => Err(CircuitError::InvalidParentOp {
parent,
optype: optype.clone(),
Expand Down

0 comments on commit 5f6750b

Please sign in to comment.