Skip to content

Commit

Permalink
Fix insert_port_types
Browse files Browse the repository at this point in the history
  • Loading branch information
mark-koch authored and doug-q committed May 2, 2024
1 parent 2d9f80b commit e8c1822
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions hugr-py/src/hugr/serialization/ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,12 +173,12 @@ def insert_port_types(self, in_types: TypeRow, out_types: TypeRow) -> None:
def insert_child_dfg_signature(self, inputs: TypeRow, outputs: TypeRow) -> None:
self.inputs = inputs
pred = outputs[0].root
assert isinstance(pred, tys.SumType)
if isinstance(pred.root, tys.UnitSum):
self.sum_rows = [[] for _ in range(pred.root.size)]
assert isinstance(pred, tys.TaggedSumType)
if isinstance(pred.st.root, tys.UnitSum):
self.sum_rows = [[] for _ in range(pred.st.root.size)]
else:
self.sum_rows = []
for variant in pred.root.rows:
for variant in pred.st.root.rows:
self.sum_rows.append(variant)
self.other_outputs = outputs[1:]

Expand Down Expand Up @@ -337,8 +337,8 @@ def insert_port_types(self, in_types: TypeRow, out_types: TypeRow) -> None:
# First port is a predicate, i.e. a sum of tuple types. We need to unpack
# those into a list of type rows
pred = in_types[0]
assert isinstance(pred.root, tys.SumType)
sum = pred.root.root
assert isinstance(pred.root, tys.TaggedSumType)
sum = pred.root.st.root
if isinstance(sum, tys.UnitSum):
self.sum_rows = [[] for _ in range(sum.size)]
else:
Expand Down

0 comments on commit e8c1822

Please sign in to comment.