Skip to content

squin.cirq.emit_circuit not erroring when emitting a feed-forward circuit #474

@jon-wurtz

Description

@jon-wurtz

The following code should error, but it does not, consistent with the .

@squin.kernel
def t_teleport_noargs():
    """
    A simple T teleportation circuit that requires mid circuit control flow.
    """
    ancilla = squin.qubit.new(1)[0]
    target = squin.qubit.new(1)[0]
    squin.gate.t(ancilla)
    squin.gate.cx(target, ancilla)
    if squin.qubit.measure(target):
        squin.gate.s(ancilla)
        squin.gate.x(ancilla)
try:
    print(squin.cirq.emit_circuit(t_teleport_noargs))
    raise(RuntimeError("Oops this should have errored."))
except Exception as e:
    print("ERROR:",e)

Instead, it generates the following printed circuit

                                   [ 0: ───X─── ]
0: ───[ 0: ───T─── ](no_rep_ids)───[       │    ]───────────────────
                                   [ 1: ───@─── ](no_rep_ids)
                                   │
1: ────────────────────────────────#2───────────────────────────M───

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions