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

source-academy / py-slang / 28924131249
78%

Build:
DEFAULT BRANCH: main
Ran 08 Jul 2026 07:07AM UTC
Jobs 1
Files 87
Run time 1min
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

08 Jul 2026 07:03AM UTC coverage: 77.373% (+0.01%) from 77.363%
28924131249

push

github

web-flow
Fix currentLine collapsing to 0 during for/range() loop synthetic steps (#234)

* Fix currentLine collapsing to 0 during for/range() loop synthetic steps

context.runtime.nodes[0]?.startToken?.line was read directly, with no
guard for runtime-fabricated nodes (implicit range() start/step bounds,
the per-iteration loop-variable increment). Those synthetic tokens are
always constructed with line: 0, since they don't correspond to any
line the user wrote. Real tokens are always 1-based (see
parser/token-bridge.ts), so line 0 is an unambiguous "not a real line"
signal — no dependency on any synthetic-token metadata is needed to
detect it.

generateForIncrement runs on every iteration of every for/range() loop,
so this wasn't a rare corner case: currentLine would collapse to 0 for
roughly half the steps of even a trivial 3-iteration loop, and (worse)
the for-line's reported line never recovered after the loop's first
iteration — every subsequent condition re-check and increment
overwrote it with 0 instead.

Fix: track the last real (line > 0) line seen and keep reporting it
whenever the current node's own line is 0, instead of overwriting with
the meaningless synthetic value.

Fixes #233.

* Give for/range() loop's synthetic bookkeeping nodes the real for-line

The previous fix (keeping the last real line while a synthetic node is
evaluating) eliminated the currentLine: 0 bug, but produced sticky
behavior: since the loop's condition-recheck and increment machinery
is entirely synthetic from the second iteration onward, currentLine
would latch onto the last real line seen (the loop body) and never
show the for-line again, even while the loop's own condition/increment
was conceptually what was executing.

These synthetic nodes (evaluateForIterator's implicit range() bounds,
generateForIncrement, and the FOR instruction handler's per-iteration
nodes) are logically part of evaluating the for-statement, so give them
its real line instead of 0 or nothing. curren... (continued)

2603 of 3644 branches covered (71.43%)

Branch coverage included in aggregate %.

13 of 13 new or added lines in 3 files covered. (100.0%)

6110 of 7617 relevant lines covered (80.22%)

14067.02 hits per line

Jobs
ID Job ID Ran Files Coverage
1 28924131249.1 08 Jul 2026 07:07AM UTC 87
77.37
GitHub Action Run
Source Files on build 28924131249
  • Tree
  • List 87
  • Changed 3
  • Source Changed 3
  • Coverage Changed 3
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Repo
  • Github Actions Build #28924131249
  • 589203f8 on github
  • Prev Build on main (#28920042345)
  • Next Build on main (#28924649834)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc