Repository navigation
feat(t27b): fixed-size arrays [N]T -- literals, indexing, .len, for (Closes #6245) - #6247
Merged
Merged
Conversation
…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>
This was referenced Oct 4, 2026
Closed
This was referenced Oct 4, 2026
Contributor
This was referenced Oct 4, 2026
Merged
This was referenced Oct 4, 2026
Contributor
PR DashboardGenerated at: 2026-10-04 20:02:29 UTC
Summary
Seal Status
|
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 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.a[i]supports read, write and compound assignment, including through*[N]Tand struct fields. The index is u64. A constant index out of range is refused, because Zig refuses it at compile time. A runtime index trapsindex out of bounds, which matches Zig's panic. This uses the existing IRBoundsnode..lenis the constant N.for (a) |x|walks the elements with a hidden index.breakandcontinuework.Val::A) and are materialized into a frame temp only where memory is needed.Only
cli/t27b/src/lower.rschanges. The IR, the interpreter and the AArch64 back end are untouched. New tests incli/t27b/tests/source.rs:arrays_literals_indexing_len_and_forchecks interpreter vs JIT and the bounds trap line. Its source also passes the reference path: 4 tests pass and the 5th panics withindex out of bounds: index 3, len 3.array_rejections_are_precisecovers 11 cases.Corpus
t27b corpus specs --jobs 6on the local corpus, which is native macOS arm64:type [N]Tdrops from the first rejection in 405 files to 27; it was in the 2292 rejection counts and is now 245.specs/ui/viewport.t27. Its test multipliesu8values, 12 * 54 = 648, which overflows. The reference fails on the same expression:t27c test-reportgives 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.jsonis not edited, since it is being re-blessed in #6235.77 newly passing files (with runtime asserts)
specs/api/tri_net_api.t27specs/automation/inngest-probe-suite.t27specs/base/ring_32.t27specs/catalog/discovery.t27specs/fpga/adapter.t27specs/port/trinity/fpga/openxc7-synth/d_oscillator.t27specs/port/trinity/src/tri/gen_leb128.t27specs/providers/catalog.t27specs/providers/gonka/deepseek-v4-flash-0731.t27specs/providers/gonka/glm-5-2-fp8.t27specs/providers/gonka/glm-5-3-flash.t27specs/providers/gonka/kimi-k2-6.t27specs/providers/gonka/minimax-m2-7.t27specs/providers/tri_gnk_pair.t27specs/providers/trinet/fpga-xc7a200t.t27specs/providers/trinet/gpu-consumer-24gb.t27specs/queen/dispatch.t27specs/queen/views.t27specs/ternary/bitnet_layer.t27specs/ternary/bitnet_mlp.t27specs/ternary/bitnet_neuron_nchunk.t27specs/trinity/build_graph.t27specs/trinity/capabilities/abi.c-api.t27specs/trinity/capabilities/agent.daemons.t27specs/trinity/capabilities/agent.phi-loop.t27specs/trinity/capabilities/agent.tri-api.t27specs/trinity/capabilities/api.http-server.t27specs/trinity/capabilities/archive.legacy.t27specs/trinity/capabilities/bench.suite.t27specs/trinity/capabilities/bot.tri-bot.t27specs/trinity/capabilities/brain.regions.t27specs/trinity/capabilities/catalog.spec-mirror.t27specs/trinity/capabilities/catalog.world-scan.t27specs/trinity/capabilities/cli.tri.t27specs/trinity/capabilities/convert.b2t.t27specs/trinity/capabilities/examples.zig.t27specs/trinity/capabilities/ext.vscode-swe.t27specs/trinity/capabilities/fpga.adapter.t27specs/trinity/capabilities/fpga.in-repo.t27specs/trinity/capabilities/lib.trinity.t27specs/trinity/capabilities/llm.firebird.t27specs/trinity/capabilities/llm.igla-chat.t27specs/trinity/capabilities/mcp.needle-mcp.t27specs/trinity/capabilities/mcp.trinity-mcp.t27specs/trinity/capabilities/native.canvas.t27specs/trinity/capabilities/native.node-gui.t27specs/trinity/capabilities/native.queen-app.t27specs/trinity/capabilities/node.trinity-node.t27specs/trinity/capabilities/numeric.golden-float.t27specs/trinity/capabilities/ops.deploy-infra.t27specs/trinity/capabilities/ops.railway-cli.t27specs/trinity/capabilities/pkg.vendored-cache.t27specs/trinity/capabilities/queen.lib.t27specs/trinity/capabilities/registry.commands.t27specs/trinity/capabilities/release.packaging.t27specs/trinity/capabilities/research.nexus-docs.t27specs/trinity/capabilities/research.programs.t27specs/trinity/capabilities/research.unreferenced-sources.t27specs/trinity/capabilities/search.vsa-index.t27specs/trinity/capabilities/specs.t27-vendored-compiler.t27specs/trinity/capabilities/specs.tri-corpus.t27specs/trinity/capabilities/specs.vibee-corpus.t27specs/trinity/capabilities/state.trinity-dir.t27specs/trinity/capabilities/test.graph.t27specs/trinity/capabilities/tools.scripts.t27specs/trinity/capabilities/train.hslm.t27specs/trinity/capabilities/training.targets.t27specs/trinity/capabilities/tri27.programs.t27specs/trinity/capabilities/tri27.toolchain.t27specs/trinity/capabilities/vibee.compiler.t27specs/trinity/capabilities/vsa.zig-hdc.t27specs/trinity/capabilities/web.docsite.t27specs/trinity/capabilities/web.queen-web.t27specs/trinity/capabilities/web.site.t27specs/trinity/project.t27specs/ui/queen_evidence.t27specs/xilinx7/far.t27The 240 newly pass_vacuous files are mostly module-level
pub const X: [N]str = [...]and[0]str = []tables.Not yet (remaining
[N]Tsubsets)[]Tslices and slicing (type []Tis now the top blocker: 136 files)[_]Tinferred lengths**repeatfor (0..n)and multi-iterablefors[i]on strusizeas a type name==on arraysSeparate finding: the reference gen emits a whole-variable reassignment inside a
testblock (x = e;) asconst x = e;, which fails to compile with "redeclaration of local variable". It is pre-existing and not touched here.🤖 Generated with Claude Code