CQCL/hugr

Support more DFG containers in `SimpleReplament`

Closed this issue · 2 comments

SiblingSubgraph::create_simple_replacement requires the region root to be an Optype::Dfg.

if !OpTag::Dfg.is_superset(dfg_optype.tag()) {
return Err(InvalidReplacement::InvalidDataflowGraph);
}

We should support FuncDefn and DataflowBlock too.

Alternatively, if we want to keep the SimpleReplacement simple and only support Dfgs there should be a helper method for converting other dataflow-like blocks into one.

We went with the alternative option and solved our usecase in tket2 by converting replacement circuits into DFGs. See CQCL/tket2#391.

We may want to bring that extraction code into hugr-passes later, but I'll mark this PR as WONTDO.