Repository navigation
gen-zig: an open-ended slice a[lo..] lowers to a Zig slice, not an index (Closes #8200) - #10319
Merged
Merged
Conversation
…_slice (refs #8200) The open-slice fix changes generated Zig for 26 specs that use a[lo..]; their seals are refreshed with tri seals drift --fix on the Railway lab. zig_open_slice.t27 calls std.debug.print, which t27b does not lower yet, so it is listed as blocked and max_not_pass moves from 76 to 77. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 18, 2026
Contributor
gHashTag
enabled auto-merge (squash)
October 18, 2026 08:49
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.
What
t27c gen(Zig backend) lowered an open-ended slicea[lo..]to the indexa[lo]. The parser marks the open slice asExprIndexwithextra_op = "slice_open"and no end child. The gen-zig emitter only recognised the bounded"slice"form, so the open form fell through to plain indexing and the range was dropped without any error.Effect on real code:
std.debug.print("{s}", .{row[0..]})reached Zig as.{ row[0] }. zig 0.16 rejects that withinvalid format string 's' for type 'u8'. This was found while streaming raw RGB frames fromspecs/t27f/reel_particles.t27(#10308). A typed local likevar t : []const u8 = a[2..];silently became one element.Fix
bootstrap/src/compiler.rs, gen-zigExprIndex: everyextra_opthat starts withslicenow lowers tobase[lo..], and also emits the end when there is a third child (base[lo..hi]). The diff is net zero lines (+3 / -3), inside the shrink-only foreign budget. The VerilogExprIndexsites are unchanged.bootstrap/stage0/FROZEN_HASH:0f8c66b9...->c485c8bd3372a8c391d5b2cd0c904dfe08155750b2d5a3e0319fbbbe62555c43.specs/compiler/zig_open_slice.t27with three tests: open slice length and first element, bounded slice sum, and the exact{s}repro on a[12]u8row.a[lo..]produce different (now correct) Zig, so their seals are refreshed withtri seals drift --fix(52 files). The new spec is sealed too:.trinity/seals/compiler_ZigOpenSlice.json.docs/reports/t27b_expectations.json: the new spec callsstd.debug.print, which t27b does not lower yet (ExprCall(std.*)). It is listed asblockedandmax_not_passgoes from 76 to 77.Evidence (Railway lab, zig 0.16 at /opt/zig)
a[2..]in a typed locala[2]a[2..].{row[from..]}.{ row[from] }, BLOCKED: invalid format string 's' for type 'u8'.{ row[from..] }row[0..].{ row[0] }, BLOCKED.{ row[0..] }, passestest-report specs/compiler/zig_open_slice.t27python3 tools/check_seal_coverage.pyAll builds and tests ran on the lab, none on the Mac.
Closes #8200
Refs #6250 (the open-slice half), #10308
🤖 Generated with Claude Code