Skip to content

t27b: an array length written as a constant expression (Closes #7347) - #7382

Closed
gHashTag wants to merge 14 commits into
masterfrom
claude/t27b-lane1-arr-type
Closed

gHashTag wants to merge 14 commits into
masterfrom
claude/t27b-lane1-arr-type

Conversation

@gHashTag

@gHashTag gHashTag commented Oct 7, 2026 •

Copy link
Copy Markdown
Owner

Closes #7347. Refs #6063.

What

t27b refused an array type whose length is not a bare literal or a bare constant name (type [N]T), for example [W*H]u8 or [N]u8 where const N = H * 5. The reference compiles these, so the refusal blocked files the reference passes.

t27b now folds the length at compile time: integer literals, module constants (typed or untyped, including one defined by another expression), + - *, the wrapping forms, parentheses and unary minus. A length that does not fold to a non-negative integer is still refused: a division, a call, a run-time value, a negative length, or a typed constant that overflows its type. Typed module constants fold the same way, so const R = Q +% 10 with Q: u8 = 250 is 4. const OV = B + 100 with B: u8 = 200 is refused, matching the reference's refusal.

Evidence (lab, --jobs 2, no interpreter fallback, no skipped tests)

  • Dogfood spec specs/tri/t27b/conformance/array_len_expr.t27: 5 pass, 0 vacuous in the reference; the same 5 in t27b, 16 runtime asserts.
  • 7 mutants each fail the same tests in both. Of 22 probes, 9 pass in both, 2 fail in both, and 8 are blocked by the reference and refused by t27b. The other 3 are honest t27b refusals where the reference passes: a length using /, a length using a call, and a 50 KB local array over the frame limit.
  • cargo test -p t27b: 14 suites, 128 passed, 0 failed (at 7a7688c).
  • Lab corpus, branch 8c677e1 vs master e45ba56: t27b pass where the reference passes 818 -> 819, mismatch 0, reference_disagree 0. The only other change is routes/memory.t27, which now stops at FnDecl(frame size) instead of type [N]T.
  • Ledger docs/reports/t27b_expectations.json recounted after merging master 05e633d (pass 534, vacuous 262, not_pass 25); no duplicate paths.

Foreign code

cli/t27b/src/lower.rs and cli/t27b/tests/source.rs are Rust. The owner approved foreign Rust in cli/t27b for #6063 and asked agents to set the owner-approved-foreign label themselves. Both files are listed in tools/policy/foreign-exceptions.txt.

NOW entry: docs/now/2026-10-07-t27b-array-len-expr.md.

🤖 Generated with Claude Code

gHashTag and others added 7 commits October 7, 2026 14:38
[W + 1]u8, [(W + 1) * 2]u16, [H * 2]u64 with H: u32: the length text is
parsed back and folded as a module constant is, as Zig folds the text t27c
prints. Run-time names, calls and negative lengths are refused.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ts (Closes #7347)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…oses #7347)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rr-type

# Conflicts:
#	tools/policy/foreign-exceptions.txt
…loses #7347)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…essions (Closes #7347)

array_len_expr.t27 moves to pass; routes/memory.t27 now stops at
FnDecl(frame size). Lab corpus at --jobs 2: 818 -> 819, mismatch 0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rr-type

# Conflicts:
#	docs/reports/t27b_expectations.json
This was referenced Oct 9, 2026
gHashTag and others added 6 commits October 10, 2026 18:07
Takes master's ledger rows (the ratchet re-bless after the merge recounts
max_not_pass and re-adds array_len_expr.t27), keeps both sides' source.rs
tests and foreign-exception blocks, so GitHub's update-branch can merge
master in without a conflict.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
lower.rs with master's auto-merge, source.rs with both sides' tests,
master's current ledger rows (the ratchet re-bless recounts after the
merge), and both sides' foreign-exception blocks -- so update-branch
merges master in without a conflict.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…s append points

Both files are appended to by master at the same tail the lane added to,
which is what makes update-branch refuse. The lane's additions move into
regions master has not touched since the merge base, so the server-side
merge combines them cleanly. Content is unchanged, only position.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The spot after cli/tri/src/mutate.rs sits against master's newest hunk
context; one more stable region down the two appends no longer touch.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…s additions

The incremental resolutions had drifted (a lost blank, a dropped
criteria_backfill.py line). source.rs and foreign-exceptions.txt are now
byte-identical to master outside one insertion each, parked in regions
master has not touched since the merge base, so update-branch merges
without a conflict.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

PR Dashboard

Generated at: 2026-10-10 11:52:26 UTC

Summary

Status Count
Total Open PRs 50
PRs with Failing Checks 49
PRs with All Checks Green 1
READY 0
FAILING 49
PENDING 0
NO CHECKS YET 0

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

Seal Status

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

Superseded by #8666 (merged 2026-10-10): t27b reads an array length written as a constant expression (literals, + - * / %, parentheses, unary minus, named constants) in specs/tri/t27b/type_text.t27, with conformance/array_length_expr.t27. Closing this older branch; reopen if it covers a case #8666 does not.

@gHashTag gHashTag closed this Oct 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

owner-approved-foreign Owner-approved exception to the only-t27 rule: hand-written foreign code allowed in this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

t27b: an array length that is a compile-time expression ([N + 1]T)

1 participant