Skip to content

feat(t27b): lower the multi-object for loop - #6575

Merged
gHashTag merged 3 commits into
masterfrom
claude/t27b-tail-formulti-2
Oct 5, 2026
Merged

gHashTag merged 3 commits into
masterfrom
claude/t27b-tail-formulti-2

Conversation

@gHashTag

@gHashTag gHashTag commented Oct 5, 2026

Copy link
Copy Markdown
Owner

Closes #6458
Refs #6063

What

  • for (a, b) |x, y| (a multi-object for over arrays and slices) lowers as one loop over the shared length, with one capture per object.
  • Equal lengths are required, as in Zig:
    • When the lengths are known at compile time and differ, the loop is refused ("lengths {a} and {b} differ at compile time"), because the reference cannot compile it.
    • When a length is only known at run time, a check before the loop traps on a mismatch, as Zig's safety check panics. This is a new trap kind, TrapKind::ForLength = 17 ("for loop over objects with non-equal lengths").
  • Still refused: a range among the objects, and a capture count that differs from the object count.
  • The single-object path now goes through the same helpers: for_iterable, then for_objects.
  • Code is in the new submodule cli/t27b/src/lower/formulti.rs; lower.rs keeps the hook, and ir.rs gains the trap kind.

Owner exception

Allowed by the owner 2026-10-05; debt to be replaced via #6198.

The local only-t27 hook (#6511) read an uncommitted line in tools/policy/foreign-exceptions.txt that names this PR's paths. That line is not in this PR, so the exception ends with the PR.

Files

File Class
cli/t27b/src/ir.rs (trap kind) hand-written Rust (owner exception)
cli/t27b/src/lower.rs (hook and extracted helper) hand-written Rust (owner exception)
cli/t27b/src/lower/formulti.rs hand-written Rust (owner exception)
cli/t27b/tests/formulti.rs hand-written Rust tests (owner exception)
cli/t27b/tests/source.rs (dropped the multi-object refusal case) hand-written Rust tests (owner exception)
docs/now/2026-10-05-t27b-formulti.md prose (NOW entry)

Tests

  • cargo test -p t27b: all green.
  • tests/formulti.rs has 3 tests: equal lengths pass, a run-time mismatch traps, and a comptime mismatch is refused. Each source was run under t27c test-report first.

Corpus (t27b corpus specs --blockers --reference <t27c> --reference-cache, jobs 8)

counted (t27b pass where reference passes) checked pass where reference fails mismatch
after #6537, #6567 and the lencall PR 685 / 728 404 0 0
this branch 685 / 728 404 0 0

No file changes verdict on its own. The two files this blocked still have another blocker each:

  • gen_cross_entropy needs @log.
  • gen_linear_regression needs &[_]f64{ ... } locals; those come in the next PR, which unlocks it.

🤖 Generated with Claude Code

gHashTag and others added 3 commits October 5, 2026 23:02
for (xs, ys) |x, y| walks every object with one hidden index; runtime
length mismatch traps as ForLength, comptime mismatch is refused (the
reference is BLOCKED on it).

Closes #6458
Refs #6063

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@gHashTag gHashTag added the owner-approved-foreign Owner-approved exception to the only-t27 rule: hand-written foreign code allowed in this PR label Oct 5, 2026
@github-actions

github-actions Bot commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

PR Dashboard

Generated at: 2026-10-05 17:28:36 UTC

Summary

Status Count
Total Open PRs 50
PRs with Failing Checks 41
PRs with All Checks Green 9
READY 9
FAILING 41
PENDING 0
NO CHECKS YET 0

Seal Status

  • ⚠️ STALE -- sha256(compiler.rs)=9f2c8a4829f6 != manifest seal=87e5cbd3ad94.
    The committed NMSE numbers were certified against an older compiler.rs.
    Run scripts/reseal-check.sh locally for the two-step reseal command (advisory; not a merge gate).

@gHashTag
gHashTag merged commit f3ef2bf into master Oct 5, 2026
30 of 33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

owner-approved-foreign Owner-approved exception to the only-t27 rule: hand-written foreign code allowed in this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

t27b: lower the multi-object for loop (StmtFor(multi-object))

1 participant