from hugr.build import Function
from hugr import tys, ops
mod = Module()
main = mod.define_function("main", [], 4 * [tys.Unit])
unit = main.add_op(ops.MakeTuple())
main.set_outputs(*4*[unit])
print(mod.hugr.num_out_ports(main))
This should output 1 (function defns have one outport), but we get 4. It looks like we mistakenly use the inner signature.
Potential fix is to stop calling _set_parent_output_count in Function.declare_outputs