From e8c18227c4573e39e33c4646e24175fb8cd002c1 Mon Sep 17 00:00:00 2001 From: Mark Koch Date: Thu, 2 May 2024 10:20:26 +0100 Subject: [PATCH] Fix insert_port_types --- hugr-py/src/hugr/serialization/ops.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/hugr-py/src/hugr/serialization/ops.py b/hugr-py/src/hugr/serialization/ops.py index 3ac5b1621..985bd37c9 100644 --- a/hugr-py/src/hugr/serialization/ops.py +++ b/hugr-py/src/hugr/serialization/ops.py @@ -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:] @@ -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: