diff --git a/quantinuum-hugr-py/src/quantinuum_hugr/serialization/ops.py b/quantinuum-hugr-py/src/quantinuum_hugr/serialization/ops.py index b5da17687..2bc9824dd 100644 --- a/quantinuum-hugr-py/src/quantinuum_hugr/serialization/ops.py +++ b/quantinuum-hugr-py/src/quantinuum_hugr/serialization/ops.py @@ -168,10 +168,6 @@ class DataflowBlock(BaseOp): extension_delta: ExtensionSet = Field(default_factory=list) def insert_port_types(self, in_types: TypeRow, out_types: TypeRow) -> None: - # The types will be all None because it's not dataflow, but we only care about - # the number of outputs. Note that we don't make use of the HUGR feature where - # the variant data is appended to successor input. Thus, `predicate_variants` - # will only contain empty rows. num_cases = len(out_types) self.sum_rows = [[] for _ in range(num_cases)] @@ -192,7 +188,15 @@ def insert_child_dfg_signature(self, inputs: TypeRow, outputs: TypeRow) -> None: class Config: # Needed to avoid random '\n's in the pydantic description json_schema_extra = { - "description": "A CFG basic block node. The signature is that of the internal Dataflow graph." + "required": [ + "parent", + "op", + "inputs", + "other_outputs", + "sum_rows", + "extension_delta", + ], + "description": "A CFG basic block node. The signature is that of the internal Dataflow graph.", } @@ -478,9 +482,6 @@ class TypeApply(LeafOpBase): class TypeApplication(BaseModel): """Records details of an application of a PolyFuncType to some TypeArgs and the result (a less-, but still potentially-, polymorphic type). - - Note that Guppy only generates full type applications, where the result is a - monomorphic type. Partial type applications are not used by Guppy. """ input: PolyFuncType diff --git a/quantinuum-hugr-py/src/quantinuum_hugr/serialization/tys.py b/quantinuum-hugr-py/src/quantinuum_hugr/serialization/tys.py index ce8289ac4..effc53d18 100644 --- a/quantinuum-hugr-py/src/quantinuum_hugr/serialization/tys.py +++ b/quantinuum-hugr-py/src/quantinuum_hugr/serialization/tys.py @@ -161,21 +161,13 @@ class UnitSum(BaseModel): class GeneralSum(BaseModel): - """General sum type that explicitly stores the types of the variants""" + """General sum type that explicitly stores the types of the variants.""" t: Literal["Sum"] = "Sum" s: Literal["General"] = "General" rows: list["TypeRow"] - class Config: - # Needed to avoid random '\n's in the pydantic description - json_schema_extra = { - "description": ( - "General sum type that explicitly stores the types of the variants." - ) - } - class SumType(RootModel): root: Union[UnitSum, GeneralSum] = Field(discriminator="s") diff --git a/specification/schema/hugr_schema_v1.json b/specification/schema/hugr_schema_v1.json index 0c41b4ea0..3e0a38165 100644 --- a/specification/schema/hugr_schema_v1.json +++ b/specification/schema/hugr_schema_v1.json @@ -383,7 +383,12 @@ } }, "required": [ - "parent" + "parent", + "op", + "inputs", + "other_outputs", + "sum_rows", + "extension_delta" ], "title": "DataflowBlock", "type": "object"