from hugr import tys
from hugr.build import Dfg
from tket2_exts import quantum
QUANTUM_EXT = quantum()
dfg = Dfg(tys.Qubit)
meas = dfg.add_op(QUANTUM_EXT.get_op("MeasureFree").instantiate(), *dfg.inputs())
alloc = dfg.add_op(QUANTUM_EXT.get_op("QAlloc").instantiate())
dfg.hugr.add_order_link(meas, alloc)
dfg.set_outputs(alloc)
Validation fails with
Connected ports Port(Outgoing, 0) in Node(7) and Port(Incoming, 0) in Node(8) have incompatible kinds. Cannot connect bool to StateOrder.
The state order source is mistakenly attached to the bool output of the MeasureFree op.
This causes a bug in Guppy: #1092