Include endpoints when unrolling qubit ranges - #442
danielgaskins wants to merge 1 commit into
Conversation
Signed-off-by: Daniel Gaskins <danielgaskins99@gmail.com>
Argus reviewAuto-review is off for this repo. Tick the box below to run a review on this PR.
Estimated cost
Tip: you can also comment |
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository: qBraid/pyqasm/.coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
Thanks @danielgaskins for the work! I think this looks good overall, but would you also be able to figure out the blast radius inside qBraid SDK |
Summary of changes
OpenQASM qubit ranges include their endpoint, but pyqasm was treating it like Python's exclusive slice bound. A gate on
q[0:1]would run only onq[0], andq[3:3]would do nothing. This fixes the shared range helper for forward and reverse steps. It also rejects an endpoint beyond the register.I updated tests that expected the old behavior, including aliases, barriers, measurements, subroutine arguments, CLI fixtures, and circuit drawing. New regression tests cover single-element, stepped, open-ended, alias, and out-of-bounds ranges.
The full suite passes with 915 tests and 3 skips. Pylint, Black, isort, mypy, the license-header check, and whitespace checks pass.
Closes #432.