v8.1.13 - Real QASM3 for-loop unrolling
Fixed
QASMParserdeclared OpenQASM 3.0 support butfor/if/while/defblocks — brace-delimited, not;-terminated — were mishandled by the naivesplit(';')statement splitter: afor-loop's body was never extracted, and its closing}merged into whatever real statement followed on the same line, corrupting it too. Verified:for int i in [0:2] { h q[i]; } cx q[0],q[1];produced a single ghost op named'}', with the loop body lost and the realcxsilently dropped — executed circuit stayed|000⟩at 100% probability, no error.
Needed for writing VQE ansätze with a loop over qubits instead of one line per qubit.
Added _process_block_constructs, run before the ;-split: for-loops with resolvable integer bounds (literals, or int/const int variables declared earlier in the source — QASM3's inclusive-end range semantics) are now genuinely unrolled by substituting the loop variable into the body per iteration; if/while/def blocks and for-loops with unresolvable bounds are cleanly stripped instead of corrupting the source that follows them.