Skip to content

Fix/exclusive range bounds 730 - #738

Open
1932819331hy-debug wants to merge 3 commits into
limitlessprojects:mainfrom
1932819331hy-debug:fix/exclusive-range-bounds-730
Open

1932819331hy-debug wants to merge 3 commits into
limitlessprojects:mainfrom
1932819331hy-debug:fix/exclusive-range-bounds-730

Conversation

@1932819331hy-debug

Copy link
Copy Markdown
Contributor

Fixes #730.

Root cause

Exclusive integer ranges previously re-evaluated their upper bound on every iteration, after the loop variable was introduced.

This caused incorrect behavior under variable shadowing, mutable bounds, and side-effecting expressions. Inclusive ranges already captured their bounds once, creating inconsistent semantics.

Changes

  • Capture both range bounds exactly once, before introducing the loop variable.
  • Align exclusive and inclusive range evaluation semantics.
  • Correct outer-binding detection in rangebind.rs.
  • Remove obsolete upper-bound reads from checker back-edge analysis.
  • Add regression tests for shadowing, mutation, and side effects.
  • Update historical golden-shape assertions.

Verification

Fork validation PR: 1932819331hy-debug#6

Successful CI: https://github.com/1932819331hy-debug/Go-Hybrid/actions/runs/39175226566

Both quick and compiler jobs passed, including Rust workspace tests, checker corpus, differential tests, and Go integration checks.

AI-assisted implementation. Credit for the original bug report belongs to the reporter of #730.

)

Align exclusive and inclusive range lowering, retain outer bound reads under shadowing, and remove non-existent bound reads from loop back-edge analysis.

Add regression shapes for shadowing, mutation, and side-effecting bounds.

AI-assisted change; requires independent CI and end-to-end verification.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant