Skip to content

Reject continue placed directly in a for update region - #30

Merged
Leitwolf11 merged 3 commits into
mainfrom
fix/for-update-continue
Oct 2, 2026
Merged

Leitwolf11 merged 3 commits into
mainfrom
fix/for-update-continue

Conversation

@Leitwolf11

Copy link
Copy Markdown
Contributor

What changed

The update list of a classic for loop is that loop's continuation point. A continue placed there had no defined
target: both CorePrep lowerings turned it into a jump back to the start of the update, which skips the condition and
never terminates. Source code cannot produce it, because a for update is a list of expressions, but Core built or
transformed by other means could.

Both Core verifiers now track where a transfer would go (outside a loop, in a loop body, or in a for update
region) instead of only a loop depth.

  • continue directly in an update region, including inside a branch there: rejected with VXC1066.
  • break in an update region: still valid, exits the loop.
  • continue in a loop nested inside an update region: valid, that loop has its own continuation point.
  • Transfers outside any loop keep their existing diagnostics.

Verification

  • cabal test visual-xsharp-compiler-tests: PASS, including eight new verifier cases.
  • go run ./helpers/cmd/develop test: all 21 native suites passed (Windows), including the new native verifier case.
  • verify-docs and clang-format: PASS.

macOS and Linux were not run locally.

Leitwolf11 and others added 3 commits October 2, 2026 04:18
The update list of a classic for loop is that loop's continuation point. A
continue there has no later point of the same iteration to reach, and both
CorePrep lowerings turned it into a jump back to the start of the update,
which skips the condition and never terminates. Source code cannot produce
it because a for update is a list of expressions, but Core built or
transformed by other means could.

Both Core verifiers now track where a transfer would go instead of only a
loop depth: outside a loop, in a loop body, or in a for update region. A
continue directly in an update region, including inside a branch there, is
rejected with VXC1066. A break in an update region stays valid and exits the
loop, and a continue in a loop nested inside an update region is valid again
because that loop has its own continuation point. Existing diagnostics for
transfers outside any loop are unchanged.

The Haskell and native verifier suites cover each case, and the Core IR
document states the rule.
@Leitwolf11
Leitwolf11 marked this pull request as ready for review October 2, 2026 19:34
@Leitwolf11
Leitwolf11 merged commit 41aa4c7 into main Oct 2, 2026
73 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant