@@ -1313,7 +1313,14 @@ def _build_quantum_call_parameters(self, parameters) -> list[ast.Expression]:
13131313
13141314 def build_defcal_call (self , instruction : CircuitInstruction , defcal : DefcalInstruction ):
13151315 """Build a statement associated with a defcal instruction."""
1316- # We forbade return types other than `Bool` and `None` in the initialiser.
1316+ # We forbade return types other than `Bool` and `None` in the initialiser,
1317+ # but we error so that this breaks if we support the full defcal spec later on.
1318+ allowed_defcal_types = (None , types .Bool ())
1319+ if defcal .return_type not in allowed_defcal_types :
1320+ raise QASM3ExporterError (
1321+ f"The defcal '{ defcal .name } ' associated with instructions with name '{ instruction .name } '"
1322+ f" returns an unsupported classical type: { defcal .return_type } "
1323+ )
13171324 returns_bit = defcal .return_type is not None
13181325 # Check simple consistency.
13191326 if (
@@ -1341,7 +1348,8 @@ def build_gate_call(self, instruction: CircuitInstruction):
13411348 This will also push the gate into the symbol table (if required), including recursively
13421349 defining the gate blocks.
13431350
1344- If ``ident`` is given, symbol-resolution will be skipped."""
1351+ If the operation identifier is found in the symbol table, symbol-resolution will be skipped.
1352+ """
13451353 operation = instruction .operation
13461354 if hasattr (operation , "_qasm_decomposition" ):
13471355 operation = operation ._qasm_decomposition ()
0 commit comments