• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Qiskit / qiskit / 31630901686
88%

Build:
DEFAULT BRANCH: main
Ran 12 Aug 2026 07:36PM UTC
Jobs 1
Files 954
Run time 2min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

12 Aug 2026 06:40PM UTC coverage: 87.774% (-0.005%) from 87.779%
31630901686

push

github

web-flow
Reimplement SymbolExpr::eval to be iterative (#16756)

* Reimplement SymbolExpr::eval to be iterative

The previous implementation of the eval method for the SymbolExpr struct
was implemented recursively. While a recursive implementation of
expression tree traversal is very natural and a consise to write this
can lead to stack growth for large expression tree. This can lead to a
stack overflow if the expression tree being traversed is sufficiently
large. To avoid this issue this commit reimplements the eval method's
tree traversal to be iterative. The core of the algorithm does an
in-order tree traversal using a while loop. There is no functional
difference in how the tree is evaluated but it avoids the stack growth
issues with the recursive implementation.

One caveat for this implementation is as eval is often used internally
for methods on the SymbolExpr struct. For example, the SymbolExpr::eq()
method's implementation internally calls eval. So this iterative
implementation has to be done very carefully to avoid introducing
recursion accidently. During development an earlier attempt relied on
SymbolExpr::eq() which caused a similar recursion issue that could lead
to a stack overflow (much more easily actually because it would nest more
deeply).

This also adds two rust tests to the symbol_expr module. These are
largely dupliclative with existing tests in the python test suite,
but they were specific edge cases I needed to debug and doing it via
rust tests was simpler. I opted to leave them in as they basically add
no overhead to the test suite and they proved useful for the development
of this PR. But the bulk of the coverage still occurs via the python
test suite and these tests weren't intended to change that.

Fixes #16676

* Use approx equality for test to account for miri fp precision

* Delete test case with fp comparison

We don't need the rust test doing the floating point value evaluation as
it's duplicated with an existing Python test. Th... (continued)

119 of 142 new or added lines in 1 file covered. (83.8%)

21 existing lines in 4 files now uncovered.

113648 of 129478 relevant lines covered (87.77%)

995404.34 hits per line

Uncovered Changes

Lines Coverage ∆ File
23
77.61
0.64% crates/circuit/src/parameter/symbol_expr.rs

Coverage Regressions

Lines Coverage ∆ File
12
97.16
-0.95% crates/qasm2/src/parse.rs
7
92.29
-0.26% crates/qasm2/src/lex.rs
1
90.32
0.0% crates/circuit/src/parameter/parameter_expression.rs
1
77.61
0.64% crates/circuit/src/parameter/symbol_expr.rs
Jobs
ID Job ID Ran Files Coverage
1 31630901686.1 12 Aug 2026 07:36PM UTC 954
87.77
GitHub Action Run
Source Files on build 31630901686
  • Tree
  • List 954
  • Changed 4
  • Source Changed 1
  • Coverage Changed 4
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Github Actions Build #31630901686
  • 0a0be0a8 on github
  • Prev Build on gh-readonly-queue/main/pr-16742-ccfdf399db5ee2aa8e17f2085c00317d4a694611 (#31609323980)
  • Next Build on main (#31702336390)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc