diff --git a/pyproject.toml b/pyproject.toml index 945b76a..4fcbaa2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -38,7 +38,7 @@ Discord = "https://discord.gg/TPBU2sa8Et" [project.optional-dependencies] cirq = ["cirq-core>=1.3.0,<1.5.0"] -qasm3 = ["pyqasm==0.0.1", "numpy"] +qasm3 = ["pyqasm==0.0.2", "numpy"] test = ["qbraid>=0.7.1,<0.9.0", "pytest", "pytest-cov", "autoqasm>=0.1.0"] lint = ["black", "isort", "pylint", "qbraid-cli>=0.8.7"] docs = ["sphinx>=7.3.7,<=8.3.0", "sphinx-autodoc-typehints>=1.24,<2.6", "sphinx-rtd-theme>=2.0,<3.1", "docutils<0.22", "sphinx-copybutton"] diff --git a/qbraid_qir/qasm3/convert.py b/qbraid_qir/qasm3/convert.py index e893d68..3c0f65a 100644 --- a/qbraid_qir/qasm3/convert.py +++ b/qbraid_qir/qasm3/convert.py @@ -52,8 +52,7 @@ def qasm3_to_qir( elif not isinstance(program, str): raise TypeError("Input quantum program must be of type openqasm3.ast.Program or str.") - qasm3_module = pyqasm.unroll(program) - + qasm3_module = pyqasm.unroll(program, as_module=True) if name is None: name = generate_module_id() llvm_module = qir_module(Context(), name) diff --git a/tests/qasm3_qir/converter/test_barrier.py b/tests/qasm3_qir/converter/test_barrier.py index 20b26f9..faef0fe 100644 --- a/tests/qasm3_qir/converter/test_barrier.py +++ b/tests/qasm3_qir/converter/test_barrier.py @@ -29,7 +29,7 @@ def test_barrier(): qubit q3; bit[2] c; - bit c2; + bit[1] c2; // Only full barrier supported in QIR diff --git a/tests/qasm3_qir/converter/test_measurement.py b/tests/qasm3_qir/converter/test_measurement.py index 6ea9b13..2594fd3 100644 --- a/tests/qasm3_qir/converter/test_measurement.py +++ b/tests/qasm3_qir/converter/test_measurement.py @@ -27,7 +27,7 @@ def test_measure(): qubit q3; bit[2] c1; - bit c2; + bit[1] c2; // supported c1 = measure q1; diff --git a/tests/qasm3_qir/converter/test_quantum_decl.py b/tests/qasm3_qir/converter/test_quantum_decl.py index 39fdfcd..89a813f 100644 --- a/tests/qasm3_qir/converter/test_quantum_decl.py +++ b/tests/qasm3_qir/converter/test_quantum_decl.py @@ -40,7 +40,7 @@ def test_clbit_declarations(): qasm3_string = """ OPENQASM 3; include "stdgates.inc"; - bit c1; + bit[1] c1; bit[2] c2; creg c3[3]; bit[1] c4; @@ -65,7 +65,7 @@ def test_qubit_clbit_declarations(): qubit[1] q4; // clbit declarations - bit c1; + bit[1] c1; bit[2] c2; creg c3[3]; bit[1] c4;