Skip to content

Commit

Permalink
add missing resolve to sum
Browse files Browse the repository at this point in the history
  • Loading branch information
ss2165 committed Aug 12, 2024
1 parent 3872980 commit a69c362
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions hugr-py/src/hugr/tys.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,10 @@ def __repr__(self) -> str:
def type_bound(self) -> TypeBound:
return TypeBound.join(*(t.type_bound() for r in self.variant_rows for t in r))

def resolve(self, registry: ext.ExtensionRegistry) -> Sum:
"""Resolve types in the sum type using the given registry."""
return Sum([[ty.resolve(registry) for ty in row] for row in self.variant_rows])

Check warning on line 263 in hugr-py/src/hugr/tys.py

View check run for this annotation

Codecov / codecov/patch

hugr-py/src/hugr/tys.py#L263

Added line #L263 was not covered by tests


@dataclass()
class UnitSum(Sum):
Expand All @@ -279,6 +283,9 @@ def __repr__(self) -> str:
return "Unit"
return f"UnitSum({self.size})"

def resolve(self, registry: ext.ExtensionRegistry) -> UnitSum:
return self


@dataclass()
class Tuple(Sum):
Expand Down

0 comments on commit a69c362

Please sign in to comment.