Skip to content

Implement and harden for loops - #124

Merged
itsfuad merged 1 commit into
mainfrom
feature/for-loop
Sep 1, 2026
Merged

Implement and harden for loops#124
itsfuad merged 1 commit into
mainfrom
feature/for-loop

Conversation

@itsfuad

@itsfuad itsfuad commented Aug 31, 2026

Copy link
Copy Markdown
Member

Summary

  • add condition, infinite, range, fixed-array, dynamic-array, and slice-view for loops with value-only and index/value bindings
  • route break and continue through canonical CFG init/header/body/latch/exit topology with exact-site ownership cleanup
  • carry typechecker-owned iteration evidence through HIR, MIR, and LLVM without backend-specific rediscovery
  • preserve loop-lifetime sequence borrows, definite-entry range evidence, malformed-header recovery, and target-sized sequence indexes
  • add positive and negative source fixtures plus feature specification artifacts

Validation

  • go test -count=1 ./...
  • go run ./scripts/bundle.go
  • PEEPER_BIN="$PWD/build/bin/peeper" go test ./x_test -count=1
  • Linux 386 and amd64 HIR/MIR/LLVM loop validation through target clang
  • git diff --check

Rules check

No pass-through compatibility wrappers, stale aliases, ignored parameters, fake source identities, duplicate iterator discovery, or backend-specific loop path were added. Generated-artifact helpers and loan filtering centralize phase-local invariants.

Closes #31.

User-defined iterator protocol remains separate follow-up: #123.

Add range and sequence iteration, break/continue CFG topology, structured HIR/MIR lowering, ownership-safe cleanup, and target-sized sequence indexes.

Add focused parser, semantic, CFG, ownership, HIR, MIR, backend, and source fixture coverage. Helpers centralize generated loop artifacts and loan-lifetime invariants rather than forwarding existing behavior.

Validated with go test -count=1 ./..., a fresh compiler bundle, the full uncached x_test suite, and 386/amd64 LLVM checks through clang.
@itsfuad itsfuad added this to the 0.3 Runtime and Iteration milestone Aug 31, 2026
@itsfuad itsfuad mentioned this pull request Aug 31, 2026
@itsfuad
itsfuad merged commit 5c5e7ed into main Sep 1, 2026
14 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.

Add iterable for loops

1 participant