Skip to content

feat(t27b): slices []T -- params, a[i..j], a[i..], .len, checked index, for - #6249

Merged
gHashTag merged 2 commits into
masterfrom
claude/t27b-slices
Oct 4, 2026
Merged

gHashTag merged 2 commits into
masterfrom
claude/t27b-slices

Conversation

@gHashTag

@gHashTag gHashTag commented Oct 4, 2026

Copy link
Copy Markdown
Owner

Closes #6248. Refs #6063. Stacked on #6247 (claude/t27b-fixed-arrays).

What

  • []T and []const T lower to a 16-byte (ptr, len) header, passed by reference like a struct. []const u8 stays str.
  • Coercions follow Zig:
    • *[N]T becomes []T.
    • *const [N]T and []T become []const T.
    • &[_]T{...} becomes []const T.
  • s[i] reads the header once, then bounds-checks the index. Out of range traps index out of bounds. str indexing is now supported.
  • x[i..j] and x[i..] work on an array, a pointer to an array, a slice or a str. Each checks i <= j <= len: constants at compile time, runtime values with a trap.
  • .len is read-only. for (s) |x| walks a slice or a str.
  • Only lowering changes. The IR, the interpreter and the AArch64 back end are untouched. There is no interpreter fallback and no skipped test, and anything unsupported is a clean, named reject.

Corpus (t27b corpus specs, macOS arm64)

before after
pass 161 (931 tests) 162 (938 tests)
pass_vacuous 278 278
fail 2 2 (same files: build_verify, viewport)
rejected 764 763
front-end error 40 40
JIT/interpreter mismatch 0 0
  • type []T was the first blocker in 136 files (237 files counting every blocker) and is now in 0.
  • Honest note: those files now stop on the next blocker (f32 42, BenchBlock 22, f64 12, ?T 6, ...). So only one more file passes in full: validation_engine.t27, which the reference also passes (7/7).
  • There are no new FAILs.
  • New top first blockers: EnumDecl 109, BenchBlock 92, f64 91, f32 64, std.mem.Allocator 44, ?T 36.

Reference bugs found

The reference t27c gen writes x[i..] as x[i] and &[_]T{} as &.{ _ }, so its Zig fails on both.

Tests

cli/t27b/tests/source.rs adds these tests:

  • slice of an array, write-through, str index and slice, literals and struct fields
  • three out-of-bounds traps (index, end, start), with the JIT agreeing with the interpreter on each trap site
  • precise rejections

cargo test -p t27b passes.

🤖 Generated with Claude Code

…x, for (Closes #6248)

[]T and []const T lower to a 16-byte (ptr, len) header in memory, an
aggregate passed by reference like a struct; []const u8 stays str.
Zig's coercions: *[N]T -> []T, *const [N]T and []T -> []const T, and
&[_]T{...} -> []const T. s[i] reads the header once and checks the
index against its length (Bounds; traps "index out of bounds"); str
indexing is now supported. x[i..j] and x[i..] of an array, pointer to
array, slice or str check i <= j <= len (constants at compile time,
otherwise a trap). .len is a read-only field; for (s) |x| walks the
elements. Only lowering changes; the IR, interpreter and AArch64 back
end are untouched.

t27b corpus specs (native macOS arm64): 161 -> 162 pass (931 -> 938
tests), 278 -> 278 pass_vacuous, 2 -> 2 fail (same files), 764 -> 763
rejected, 0 mismatch. `type []T` was the first blocker of 136 files and
is now 0; those files stop on the next blocker (f32, BenchBlock, f64,
?T ...). The reference writes x[i..] as x[i] and &[_]T{} as &.{ _ }.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
gHashTag added a commit that referenced this pull request Oct 4, 2026
…going (Closes #6244)

A non-required check red on the PR was judged against master's last
verdict even when a newer master run of it was still in progress, so a
stale SUCCESS blocked #6249. fold_master now reports PENDING for a run
still going on a newer commit, and check_effect (steward.t27) makes such
a red check WAIT. 81 tests on t27b and the t27c lab; gen-c byte-equal.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@gHashTag
gHashTag changed the base branch from claude/t27b-fixed-arrays to master October 4, 2026 20:07
@github-actions

github-actions Bot commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

PR Dashboard

Generated at: 2026-10-04 20:21:00 UTC

Summary

Status Count
Total Open PRs 47
PRs with Failing Checks 32
PRs with All Checks Green 15
READY 12
FAILING 32
PENDING 0
NO CHECKS YET 0

These columns do not partition: 12 + 32 + 0 + 0 = 44, and there are 47 open PRs. A PR is being counted twice or not at all.

Seal Status

  • ⚠️ STALE -- sha256(compiler.rs)=8597b6ded596 != 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).

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.

t27b: []T slices

1 participant