Skip to content

[BUG] Consecutive unrolls fail with consolidate_qubits=True #296

@TheGupta2012

Description

@TheGupta2012

Environment

  • PyQASM version: 1.0.1
  • Python version: 3.12
  • Operating system: macOS

What happened?

In [8]: from pyqasm import loads
   ...: 
   ...: qasm3_string = """OPENQASM 3.0;
   ...: include "stdgates.inc";
   ...: qubit[2] q;
   ...: qreg q2[3];
   ...: barrier q2;
   ...: barrier q, q2;
   ...: """
   ...: mod = loads(qasm3_string)
   ...: mod.unroll(consolidate_qubits = True)
   ...: mod.unroll(consolidate_qubits = True) 

raises -

ValidationError: Missing qubit register declaration for '__PYQASM_QUBITS__[2:]' in QuantumBarrier

Suggestions (Optional)

Looks like a bug in the handling of __PYQASM_QUBITS__ keyword in the qasm

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions