Skip to content

πŸ› Custom Gate Definitions don't follow OpenQASM standardΒ #31

@DRovara

Description

@DRovara

Environment information

Any environment

Description

Two aspects of the OpenQASM standard are not respected by the current implementation for custom gates:

  • Custom gate definitions cannot access underlying registers, only the qubits that were passed to them. The current implementation assumes this is possible, so dome of the parsing and data dependency logic is incorrect, and assertions can access quantum registers even in custom gate definitions.
  • Custom gate definitions should also support angle parameters, which, at the moment, they don't.

Expected behavior

Something like this should not work:

qreg q[3];
gate test t {
    assert-ent t, q[0];
}

Something like this should work:

gate test(x) t {
    ...
}

How to Reproduce

Run the two code snippets above in the debugger.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingc++Anything related to C++ code

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions