Skip to content

feat(t27b): fixed-size arrays [N]T -- literals, indexing, .len, for (Closes #6245) - #6247

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

gHashTag merged 2 commits into
masterfrom
claude/t27b-fixed-arrays

Conversation

@gHashTag

@gHashTag gHashTag commented Oct 4, 2026

Copy link
Copy Markdown
Owner

Closes #6245
Refs #6063

What

t27b now supports fixed-size arrays [N]T. Before this change they were the top first-rejecting construct in the lab: 405 files, 2292 occurrences on 88862a9.

  • The type. N is a literal or an integer constant. Elements can be int, bool, str or struct. The layout is elements back to back. Arrays are copied on assignment, passed by pointer and returned through sret, the same way structs are.
  • Literals. An array literal takes its result type, as t27c's Zig backend does with .{...}. The element count must equal N. A literal with no result type is refused, because Zig builds a tuple there and a runtime index into it does not compile.
  • Indexing. a[i] supports read, write and compound assignment, including through *[N]T and struct fields. The index is u64. A constant index out of range is refused, because Zig refuses it at compile time. A runtime index traps index out of bounds, which matches Zig's panic. This uses the existing IR Bounds node.
  • .len is the constant N.
  • for (a) |x| walks the elements with a hidden index. break and continue work.
  • Module constants. Scalar and struct element arrays go to rodata. Arrays of str stay compile-time values (Val::A) and are materialized into a frame temp only where memory is needed.

Only cli/t27b/src/lower.rs changes. The IR, the interpreter and the AArch64 back end are untouched. New tests in cli/t27b/tests/source.rs:

  • arrays_literals_indexing_len_and_for checks interpreter vs JIT and the bounds trap line. Its source also passes the reference path: 4 tests pass and the 5th panics with index out of bounds: index 3, len 3.
  • array_rejections_are_precise covers 11 cases.

Corpus

t27b corpus specs --jobs 6 on the local corpus, which is native macOS arm64:

before (88862a9) after
pass 84 (778 tests, 106 invariants) 161 (931 tests, 130 invariants)
pass, 0 runtime asserts 38 278
a test fails 1 2
rejected 1082 764
front-end error 40 40
JIT/interpreter mismatch 0 0
codegen limit / timeout / crash 0 / 0 / 0 0 / 0 / 0
  • type [N]T drops from the first rejection in 405 files to 27; it was in the 2292 rejection counts and is now 245.
  • No file lost its pass.
  • The one new "fails" is specs/ui/viewport.t27. Its test multiplies u8 values, 12 * 54 = 648, which overflows. The reference fails on the same expression: t27c test-report gives BLOCKED with "overflow of integer type 'u8' with value '648'". So this is a spec bug, not a t27b mismatch.

Every one of the 317 newly passing files (77 pass + 240 pass_vacuous) also passes the reference t27c test-report.

docs/reports/t27b_expectations.json is not edited, since it is being re-blessed in #6235.

77 newly passing files (with runtime asserts)
  • specs/api/tri_net_api.t27
  • specs/automation/inngest-probe-suite.t27
  • specs/base/ring_32.t27
  • specs/catalog/discovery.t27
  • specs/fpga/adapter.t27
  • specs/port/trinity/fpga/openxc7-synth/d_oscillator.t27
  • specs/port/trinity/src/tri/gen_leb128.t27
  • specs/providers/catalog.t27
  • specs/providers/gonka/deepseek-v4-flash-0731.t27
  • specs/providers/gonka/glm-5-2-fp8.t27
  • specs/providers/gonka/glm-5-3-flash.t27
  • specs/providers/gonka/kimi-k2-6.t27
  • specs/providers/gonka/minimax-m2-7.t27
  • specs/providers/tri_gnk_pair.t27
  • specs/providers/trinet/fpga-xc7a200t.t27
  • specs/providers/trinet/gpu-consumer-24gb.t27
  • specs/queen/dispatch.t27
  • specs/queen/views.t27
  • specs/ternary/bitnet_layer.t27
  • specs/ternary/bitnet_mlp.t27
  • specs/ternary/bitnet_neuron_nchunk.t27
  • specs/trinity/build_graph.t27
  • specs/trinity/capabilities/abi.c-api.t27
  • specs/trinity/capabilities/agent.daemons.t27
  • specs/trinity/capabilities/agent.phi-loop.t27
  • specs/trinity/capabilities/agent.tri-api.t27
  • specs/trinity/capabilities/api.http-server.t27
  • specs/trinity/capabilities/archive.legacy.t27
  • specs/trinity/capabilities/bench.suite.t27
  • specs/trinity/capabilities/bot.tri-bot.t27
  • specs/trinity/capabilities/brain.regions.t27
  • specs/trinity/capabilities/catalog.spec-mirror.t27
  • specs/trinity/capabilities/catalog.world-scan.t27
  • specs/trinity/capabilities/cli.tri.t27
  • specs/trinity/capabilities/convert.b2t.t27
  • specs/trinity/capabilities/examples.zig.t27
  • specs/trinity/capabilities/ext.vscode-swe.t27
  • specs/trinity/capabilities/fpga.adapter.t27
  • specs/trinity/capabilities/fpga.in-repo.t27
  • specs/trinity/capabilities/lib.trinity.t27
  • specs/trinity/capabilities/llm.firebird.t27
  • specs/trinity/capabilities/llm.igla-chat.t27
  • specs/trinity/capabilities/mcp.needle-mcp.t27
  • specs/trinity/capabilities/mcp.trinity-mcp.t27
  • specs/trinity/capabilities/native.canvas.t27
  • specs/trinity/capabilities/native.node-gui.t27
  • specs/trinity/capabilities/native.queen-app.t27
  • specs/trinity/capabilities/node.trinity-node.t27
  • specs/trinity/capabilities/numeric.golden-float.t27
  • specs/trinity/capabilities/ops.deploy-infra.t27
  • specs/trinity/capabilities/ops.railway-cli.t27
  • specs/trinity/capabilities/pkg.vendored-cache.t27
  • specs/trinity/capabilities/queen.lib.t27
  • specs/trinity/capabilities/registry.commands.t27
  • specs/trinity/capabilities/release.packaging.t27
  • specs/trinity/capabilities/research.nexus-docs.t27
  • specs/trinity/capabilities/research.programs.t27
  • specs/trinity/capabilities/research.unreferenced-sources.t27
  • specs/trinity/capabilities/search.vsa-index.t27
  • specs/trinity/capabilities/specs.t27-vendored-compiler.t27
  • specs/trinity/capabilities/specs.tri-corpus.t27
  • specs/trinity/capabilities/specs.vibee-corpus.t27
  • specs/trinity/capabilities/state.trinity-dir.t27
  • specs/trinity/capabilities/test.graph.t27
  • specs/trinity/capabilities/tools.scripts.t27
  • specs/trinity/capabilities/train.hslm.t27
  • specs/trinity/capabilities/training.targets.t27
  • specs/trinity/capabilities/tri27.programs.t27
  • specs/trinity/capabilities/tri27.toolchain.t27
  • specs/trinity/capabilities/vibee.compiler.t27
  • specs/trinity/capabilities/vsa.zig-hdc.t27
  • specs/trinity/capabilities/web.docsite.t27
  • specs/trinity/capabilities/web.queen-web.t27
  • specs/trinity/capabilities/web.site.t27
  • specs/trinity/project.t27
  • specs/ui/queen_evidence.t27
  • specs/xilinx7/far.t27

The 240 newly pass_vacuous files are mostly module-level pub const X: [N]str = [...] and [0]str = [] tables.

Not yet (remaining [N]T subsets)

  • f32/f64 elements
  • []T slices and slicing (type []T is now the top blocker: 136 files)
  • [_]T inferred lengths
  • ** repeat
  • range for (0..n) and multi-iterable for
  • s[i] on str
  • str arrays inside struct constants
  • untyped array-literal locals
  • usize as a type name
  • == on arrays

Separate finding: the reference gen emits a whole-variable reassignment inside a test block (x = e;) as const x = e;, which fails to compile with "redeclaration of local variable". It is pre-existing and not touched here.

🤖 Generated with Claude Code

…loses #6245)

[N]T (N a literal or integer constant; int, bool, str or struct
elements) lowers to N elements back to back in memory, an aggregate
like a struct: copied on assignment, passed by pointer, returned
through sret. Array literals take their result type (t27c's Zig
backend writes .{...}); the count must be N. a[i] reads and writes
with a u64 index: a constant out-of-range index is refused, a runtime
one traps "index out of bounds" like Zig. .len is the constant N;
for (a) |x| walks the elements. Module str arrays stay compile-time
values (Val::A) and are materialized only where memory is needed.
Only lowering changes; the IR, interpreter and AArch64 back end
already had Offset/Bounds/Load/Store/Copy.

t27b corpus specs (native macOS arm64): 84 -> 161 files pass
(778 -> 931 tests), 38 -> 278 pass_vacuous, 0 mismatch. All 317
newly passing files also pass the reference (t27c test-report).

Refs #6063

Closes #6245

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

PR Dashboard

Generated at: 2026-10-04 19:38:41 UTC

Summary

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

These columns do not partition: 12 + 30 + 0 + 0 = 42, and there are 45 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).

@github-actions

github-actions Bot commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

PR Dashboard

Generated at: 2026-10-04 20:02:29 UTC

Summary

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

These columns do not partition: 12 + 32 + 0 + 0 = 44, and there are 49 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: fixed-size arrays [N]T (locals, literals, indexing with bounds trap, .len, for)

1 participant