Skip to content

Empty array literal is a value, not a slice type (seal moved, Architect-approved) - #3962

Merged
gHashTag merged 1 commit into
masterfrom
fix/empty-array-literal-seal
Sep 17, 2026
Merged

gHashTag merged 1 commit into
masterfrom
fix/empty-array-literal-seal

Conversation

@gHashTag

Copy link
Copy Markdown
Owner

Closes #3960

pub const SKILLS : [0]str = []; generated = [];, which Zig rejects outright. The literal passed through to the output verbatim.

parse_bare_array_literal bailed on [ immediately followed by ] — correct for a slice TYPE, wrong for a VALUE. A slice type always names what it is a slice of, so one token of lookahead separates them. The single-element case ([7]) is genuinely ambiguous with a dimension and is deliberately untouched.

Freeze ceremony (FROZEN.md §5)

Architect-approved hotfix, authorised explicitly for this change.

M1 cargo build --release green
M2 t27c parse on touched specs no .t27 spec is touched
M3 cargo test --release 2715 passed, 0 failed — identical to the same suite on this commit without the patch
M4 tests/run_all.sh absent from the repo; the CI checks on this PR stand in
old seal  7cab95c431bcbd7416fd5b18ab3a74ee5f274d92b3bc5446bfcbd72e22579604
new seal  ace867b052b42b0ff74be3720a15448875bfc718363c71d847c0aeb1f2f5772e

What it measurably does — and does not — do

Generated files emitting = []; fall from 227 to 1. The expected type expression error class falls from 262 to 107.

The corpus pass count does not move: 279 before, 279 after, none gained, none lost. Measured by generating all 945 specs and running each under zig test, with a t27c built from this commit.

The 226 files have a second defect behind the first:

agents/c.zig:25:36: error: expected type expression, found ';'
pub const TOOLS: [1]str = [tri/gen];

A single-element literal holding an unquoted path. That is the next layer, and it is visible only because this one is gone.

Reported this way deliberately: the previous change to this corpus was announced as a large win on numbers produced by a stale compiler, and turned out to move nothing.

…ves for it

`pub const SKILLS : [0]str = [];` generated `pub const SKILLS: [0]str = [];`,
which Zig rejects: "expected type expression, found ';'". The literal passed
through to the output verbatim.

`parse_bare_array_literal` bailed on `[` immediately followed by `]`. That guard
is right for a slice TYPE and keeps the pass linear, but a slice type always
names what it is a slice OF, so one more token separates the two cases: a
bracket pair followed by anything that is not an identifier or another `[` can
only be an empty list. The emitter needed the matching case, because an array
literal with no children and no element text fell into the comma-splitting path
and produced `.{  }` with a phantom element.

A single-element literal (`[7]`) is genuinely ambiguous with a dimension and is
deliberately left alone.

## Why the seal moved

FROZEN.md §5 step 2, as an Architect-approved hotfix — authorised explicitly for
this change.

  M1  cargo build --release          green
  M2  no .t27 spec is touched by this PR
  M3  cargo test --release           2715 passed, 0 failed — identical to the
                                     same suite on this commit without the patch
  M4  the repo has no tests/run_all.sh; the CI checks on this PR stand in for it

  Old seal 7cab95c431bcbd7416fd5b18ab3a74ee5f274d92b3bc5446bfcbd72e22579604
  New seal ace867b052b42b0ff74be3720a15448875bfc718363c71d847c0aeb1f2f5772e

## What it measurably does, and does not, do

Generated files emitting `= [];` fall from **227 to 1**, and the
"expected type expression" error class falls from 262 to 107.

The corpus pass count does **not** move: 279 before, 279 after, none gained,
none lost, measured by generating all 945 specs and running each under
`zig test` with a t27c built from this commit. The 226 files have a second
defect behind the first — `pub const TOOLS: [1]str = [tri/gen];`, a
single-element literal holding an unquoted path. That is the next layer, and it
is now visible because this one is gone.

Reported this way on purpose: the previous change to this corpus was announced
as a large win on numbers that came from a stale compiler and turned out to move
nothing at all.

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

Copy link
Copy Markdown
Contributor

📓 NotebookLM Notebook linked to this PR

This notebook contains session context, decisions, and artifacts for this work.

@github-actions

Copy link
Copy Markdown
Contributor

PR Dashboard

Generated at: 2026-09-17 04:48:49 UTC

Summary

Status Count
Total Open PRs 41
PRs with Failing Checks 38
PRs with All Checks Green 3
READY 2
FAILING 38
PENDING 0
NO CHECKS YET 0

These columns do not partition: 2 + 38 + 0 + 0 = 40, and there are 41 open PRs. A PR is being counted twice or not at all.

Seal Status

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

Copy link
Copy Markdown
Owner Author

emit-bitexact / spec-guards / Corpus ratchet: not this change

All three fail on the same pre-existing set of specs that do not parsequick_sort, trie, bytes, config, utf8, version and a few more. The identical list was red on #3882 before any compiler change in this series.

Verified rather than asserted. Generating all 945 specs with a t27c built from this branch, and with one built from master:

specs that generate, before the patch:  945
specs that generate, after  the patch:  945
newly failing to generate:                0
newly generating:                         0

So the patch introduces no generation failure. The three checks are red because master carries ~10 unparseable specs, which is a real defect and a separate one.

The required checks — validate and check-linked-issue — are green.

@gHashTag
gHashTag merged commit 6e8a494 into master Sep 17, 2026
35 of 43 checks passed
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.

Empty array literal emits invalid Zig — 227 of 656 compile failures, one construct

1 participant