Repository navigation
Conversation
… verification Resolve overlapping expression preparation and loop routing changes from PRs 425 and 426. Preserve both sets of regression tests. Also unwind newly suspended break/continue paths when the combined lexical scope closes. Scope-entry offsets avoid touching paths that exited in earlier iterations. Keep 20 local cross-PR verification cases outside the upstream test suite.
This was referenced Nov 10, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue #, if available:
Fixes #424.
Description of changes:
The measurement-conditioned
breakin #424 exits the Python traversal of a branch, skipping other simulation paths and silently dropping their shots. A loop-control transfer must instead apply only to the paths that execute it, and only to their nearest enclosing loop.The exact issue repro is covered for both state-vector and density-matrix simulators, alongside the equivalent direct-condition loop as a control.
Testing done:
bfefc3c6264de4171f9ac341dbf08dacba19b4c7.NUMBA_DISABLE_JIT=1; no xfail markers changed).r=1.sqrt,sizeof, classical subroutines, and function calls inside index expressions. Those four controls pass on both the base revision and this patch; evaluator calls are also checked per path/per condition check.git diff --checkpass. Sphinx HTML builds successfully; its existing warning output matches the base revision.Integration update: depends on #425
This branch now includes #425 through a non-rewriting merge. The base remains
main, so until #425 is merged the full diff also contains its return-value work. The independent-branch results above describe the original0a50d8erevision; the following results describe the updated branch.Resolving the overlapping interpreter/context changes required preserving both function-call preparation and path-local loop control. In particular, compound assignments are expanded before preparing calls, while conditions retain their prepared-call refresh, and break/continue remain local to each simulation path.
The combination also exposed a scope-cleanup bug: with an outer
i = 99, a staticfor int iand a measurement-conditionedbreak, suspended paths retained the loop-localiand an extra frame. Scope entry now records the current loop's suspended-path list boundaries. Scope exit unwinds active paths and only paths newly suspended inside that scope; previously suspended paths are not unwound twice.git diff --checkpass. A full-tree formatting check reports the unchanged upstream blank-line issue intest_state_vector_simulator.py; it is not modified here.The standard
readonly arraygrammar fix in #428 is independent of this branch and is not included in this PR. With that parser fix also merged locally, full Braket tests pass (2,594 passed, 71 existing xfailed), as do 103 focused tests with JIT explicitly enabled. All 39 Qora compiler-to-LocalSimulator execution cases and all 39 checks through the actual extension JSON runner pass without modifying compiler-generated QASM. Qora's .NET tests also pass (1,034 + 13). These are combined local-integration results, not standalone #426 or remote-QPU results.The combined Sphinx build exits successfully. Its 100 WARNING and four existing docstring-indentation ERROR diagnostics match the earlier return/loop builds after path normalization; there are no new documentation diagnostics.
Merge Checklist
General
Tests
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.