Skip to content

unroll() rejects inv @ on a gate whose body contains nop #477

Closed

Description

@ryanhill1

unroll() rejects inv @ on a custom gate whose body contains nop. nop is its own inverse, so this should unroll to the same nops.

from pyqasm import loads
m = loads('OPENQASM 3.0;\ninclude "stdgates.inc";\ngate g a { nop a; }\nqubit[1] q;\ninv @ g q[0];')
m.unroll()
# ValidationError: Unsupported / undeclared QASM operation: nop

The same happens on main with openqasm3 1.0.1 and on #475 with 1.0.2. The inverse path (map_qasm_inv_op_to_callable) has no entry for nop. Without inv, g q[0]; unrolls to nop q[0];.

Found while reviewing #475.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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