Skip to content

VBD V4: Pattern is a value enum with Box children (Generation B, after the v0.2.65 seed) - #1439

Merged
shd101wyy merged 8 commits into
developfrom
feat/vbd-v4-pattern-box
Oct 18, 2026
Merged

shd101wyy merged 8 commits into
developfrom
feat/vbd-v4-pattern-box

Conversation

@shd101wyy

@shd101wyy shd101wyy commented Oct 17, 2026 •

Copy link
Copy Markdown
Owner

The seed wait is satisfied. v0.2.65 is published and carries #1438: a stage 1 built by the v0.2.65 seed no longer crashes on move_only (the v0.2.64-seed crash — a lost E0901 inside a Box(sub) arm of _augment_arm_pattern — is the #1438 bug and is fixed by the seed). Re-gated and marked ready on the v0.2.65 seed; see the re-gate block below.

Summary

VBD V4 (plans/VALUES_BY_DEFAULT.md §6 V4, decisions 21 and 31): Pattern (src/pattern.yo) becomes a value enum with unique Box children. It follows #1435 (Z3Sexpr) and #1438, the unwind S1 that this conversion exposed.

  • Representation. At's and ThroughBox's sub are Box(Self); the sub-pattern lists stay ArrayList(Self).
  • Clone. derive(Clone) refuses an enum that mixes Box(Self) with ArrayList(Self), so Pattern has a manual Clone. It deep-clones through Box.clone and clone_patterns, and shares the field_idx / elem_tys handles.
  • Arms and constructions. Arms spell Box(sub), which the seed carries. Constructions use box(...).
  • Element access (the ArrayList is still a handle). For a move-only element, get, .clone() of the list, for(&xs, …) and match(&xs(i), …) are E0901. The tree therefore reads elements as &subs(i) arguments and subs(i).clone().
    • The usefulness walk's row specialization moved into per-row helpers: _specialize_variant_row, _specialize_aggregate_row, _expand_row_head and the _head_* predicates.
    • _useful_at delegates to _useful_head.
    • These touch src/pattern.yo, src/evaluator/exprs/match.yo, src/evaluator/exprs/pattern_compile.yo, src/codegen/exprs/match.yo and src/verifier/vc.yo.
  • New issue (S2, not fixed here): issues/2026-10-17-a-match-through-a-borrowed-element-copies-the-element.md. match(&xs(i), …) is E0901 even though E0901 names that form as its repair.
  • Docs. .github/instructions/yo-syntax.instructions.md gets the Box-enum pitfalls, and the plan gets V4's "as built" note.

Verification

Tier 1 re-gate on the v0.2.65 seed (2026-10-18; first at develop 5eed91253 / head e4473ee22, then rebased clean over develop 057420e4a — #1445, #1447's match-trap hardening, #1434, #1446, #1430 — to head 661efba12, full re-gate re-run):

  • Stage 1 yo build --std-path ./std with the v0.2.65 seed: rc=0 — the step that crashed on the v0.2.64 seed. The first re-gate needed --cc zig (the box's GCC 15.2 rejected the then-seed's exhaustive-enum-switch emission under yo's -Werror=return-type, identically on clean develop); after fix(codegen): a statement-position match in a non-void function no longer falls off the end under gcc (S1) #1447's trap closers merged, the plain default-cc (gcc) build is rc=0 — the workaround is retired.

  • The fix(codegen): a statement-position match in a non-void function no longer falls off the end under gcc (S1) #1447 interaction: this branch's codegen changes (the pattern walks in _collect_place_names / _collect_bind_decls / _emit_pattern_chain / _lookthrough_switch_cell, lines ~121-2300) and fix(codegen): a statement-position match in a non-void function no longer falls off the end under gcc (S1) #1447's construct-level trap closer in generate_match_expression (~2480) are disjoint; the trap keys on the evaluator's control_flow stamping, which this branch does not touch (0 references). match_nested — the file fix(codegen): a statement-position match in a non-void function no longer falls off the end under gcc (S1) #1447 extended with trap tests — passes 28/28 through this branch's Pattern lowering.

  • Stage 2 (the binary stage 1 produced): check ./src rc=0; check ./std rc=0.

  • Feature tests, one file per call, --parallel 1 (head 661efba12): move_only 55/55, match_nested 28/28 (25 pre-fix(codegen): a statement-position match in a non-void function no longer falls off the end under gcc (S1) #1447 + its 3 new), match_at_binding 4/4, algebraic_effects 79/79; internal/match_binding_shadow 3/3 in CI mode (YO_TEST_LEAK_VERDICT=0), the file fix(codegen): a statement-position match in a non-void function no longer falls off the end under gcc (S1) #1447 names.

  • yo fmt --check with the tree-built binary on every changed file: rc=0.

  • scripts/check-issue-refs.sh: rc=0, after repointing one citation the branch had added to its moved home (issues/fixed/a-hashmap-of-a-move-only-key-or-value-does-not-compile.md).

  • Leak comparison against develop's binary (YO_TEST_LEAK_VERDICT=1, ASan+LSan test binaries, branch stage 2 vs develop 5eed91253 built the same way, same test files; measured at head e4473ee22 — the develop move to 057420e4a touches none of the three files, so the table stands):

    tests/internal file this branch (e4473ee22) develop (5eed91253)
    verifier_quantifiers 4 passed, 2 failed — both LeakSanitizer-only, each 22,549 B / 336 allocs identical: same 2 tests, same signature
    module_invalidation 1 passed, 11 failed — all LeakSanitizer-only: 9 × 22,549 B / 336, 1 × 22,933 B / 342, 1 × 23,125 B / 345 identical: same 11 tests, same three signatures
    verifier_loops 12 passed, 2 failed — both LeakSanitizer-only, each 22,549 B / 336 allocs identical: same 2 tests, same signature

    Verdict: identical leak counts and byte/allocation signatures on every file — the "identical or fewer" criterion holds; every leak pre-exists on develop. (Method: test binaries built with gcc + -fsanitize=address through a wrapper appending -Wno-error=return-type, which only downgrades the GCC-15-only switch-fallthrough severity back to the warning CI's compilers emit; the LSan verdict was verified live — it fails leaking tests and prints full reports. module_invalidation is 12/12 in CI mode (YO_TEST_LEAK_VERDICT=0), so all 11 failures are verdict-only.)

Earlier A/B, same-input against develop's binary (both built from 5425cd7bf with seed v0.2.63, both stage-2 binaries linking mimalloc):

  • Emit-diff (compile src/main.yo --emit-c --skip-c-compiler): 0 lines.
  • Allocation ratchet, check src/main.yo: 1,828,286,478 calls against develop's 1,823,309,567 (+0.27%, from the row and arm-pattern clones). That is within ±5% of the baseline 1,799,052,684.
  • yo verify ./tests/spec --format json: identical output.

Tier 1 on the earlier rebased tree (develop fbd79fc90 plus this branch, stage 1 built with seed v0.2.64 — superseded by the re-gate above; kept as the record):

Timing. The check ./src time and stage-2 RSS A/B (exclusive, medians of 3) is pending, measured after merge. It was cancelled at the coordinator's request while the heavy queue was 35 deep. Given a byte-identical emission and a +0.27% allocation delta, no measurable change is expected.

LLM attribution

  • Model: Claude Opus 5.5
  • Agent harness (optional): Claude Code
  • v0.2.65 re-gate, leak comparison and ready-staging (2026-10-18): GLM-5.3, ZCode harness

Deferred

  • VcSort / VcTerm wait on issues/questions/2026-10-17-should-the-verifier-terms-take-box-or-rc-children.md.
  • The match(&xs(i), …) S2 above is not fixed here.
  • The timing A/B is measured after merge.

🤖 Generated with Claude Code

shd101wyy added a commit that referenced this pull request Oct 17, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
shd101wyy added a commit that referenced this pull request Oct 17, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
shd101wyy added a commit that referenced this pull request Oct 17, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
shd101wyy added a commit that referenced this pull request Oct 17, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
shd101wyy added a commit that referenced this pull request Oct 17, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
shd101wyy added a commit that referenced this pull request Oct 17, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
shd101wyy added a commit that referenced this pull request Oct 17, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
shd101wyy added a commit that referenced this pull request Oct 17, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
shd101wyy added a commit that referenced this pull request Oct 17, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
shd101wyy added a commit that referenced this pull request Oct 17, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
shd101wyy added a commit that referenced this pull request Oct 18, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
shd101wyy added a commit that referenced this pull request Oct 18, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
shd101wyy added a commit that referenced this pull request Oct 18, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
shd101wyy added a commit that referenced this pull request Oct 18, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
shd101wyy added a commit that referenced this pull request Oct 18, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
shd101wyy added a commit that referenced this pull request Oct 18, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
shd101wyy added a commit that referenced this pull request Oct 18, 2026
* docs(handover): VBD handover 2026-10-17 (living until v0.2.65)

The v0.2.65 gate, every open PR and pushed branch with what is left,
#1408's verdicts, the recursive E0916 structural-clone exemption, the open
S1s and the portable process rules learned this cycle. The plan, the plans
index and the 2026-10-15 handover point here.

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

* docs(handover): pin head SHAs, add the stale-doc safeguard, the stop sequence and a v0.2.65 notes draft

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

* docs(plans): the index lists only the current VBD handover

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

* docs(plans): drop the v0.2.51 release handover from the index

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

* docs(handover): #1435 landed; d47loc and #1432 heads

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

* docs(handover): status checks every 50 minutes

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

* docs: 40-minute cache-warm pings for background sub-agents (AGENTS.md, handover)

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

* docs(handover): #1412 landed; #1421 head

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

* docs(handover): derive Clone PR B is #1437

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

* docs(handover): #1438 landed (v0.2.65 gate item 3); notes draft

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

* docs(handover): #1409 landed; its two new issues; #1421 head

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

* docs: #1432 landed (handover; plan cites #1432 instead of the deleted branch); A4's S1 as a known issue

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

* docs(handover): Pattern is #1439, Generation B after the v0.2.65 seed

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

* docs(handover): no rebase after the final gate; SHAs from git output; #1437 head

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

* docs(handover): #1424 and #1420 landed; #1424's new issues

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

* docs(handover): #1439 state and post-seed steps; #1433 landed

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

* docs(handover): #1437 landed; its open S2

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

* docs(handover): #1419 landed

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

* docs(handover): MERGE_FREEZE for v0.2.65; decision 47 locals is #1440

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

* docs(handover): #1414 Tier 1 green, held by the freeze

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

* docs(handover): #1429 landed (v0.2.65 gate item 2)

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

* docs(handover): #1429's user-visible changes and maintainer questions

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

* docs(issues): retire the three VBD questions decided 2026-10-18; file the two projection-forwarding gaps (S2 ref receiver, S3 bare-tail E0601)

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

* docs(handover): record the 2026-10-18 verdicts; roadmap from v0.2.65 to the end of VBD; refresh branch resume points

- VALUES_BY_DEFAULT: decision 21 amended (Rc by sharing, Box when built once); §9 lists the decided questions; decision 47 step 2 records #1440's two accepted departures
- PARALLELISM_RULES D9: recommend a capture-free closure for a named function until function-item types land
- handover: §3.4 verdicts, §4 rewritten as the ordered path to finishing VBD, §2.4 resume points after the WSL crash

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

* docs(handover): v0.2.65 notes draft names #1440's surface and the Q5 known issues; D9 names the plain-local closure

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

* docs(handover): #1440 merged (00eddd3); v0.2.65 gate waits on develop battery 39087983359

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

* docs(handover): develop red after #1440 (FV job ran Gen A test files with the seed); #1441 fixes it; the lesson in §1.1

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

* docs(handover): final v0.2.65 release-notes text; held branches need a mut-bindings pass after rebasing onto #1440

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

* docs(handover): #1441 merged (e34b6b0); the v0.2.65 gate waits on develop battery 39099399553

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

* docs(handover): the four held branches re-gated on #1440 (wip/*-on-d47 heads); std stays unmarked until its sweep

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

* docs(handover): v0.2.65 gate met (battery 39099399553 green on e34b6b0); Release run 39106358669 dispatched

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

* docs(handover): #1442 joins the post-release stop sequence

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

* docs(handover): ci/fmt-check-plans joins the post-release sequence (after #1442)

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

* docs(handover): final — v0.2.65 published, #1442 and #1443 merged, freeze removed, nothing running

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

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
@shd101wyy
shd101wyy force-pushed the feat/vbd-v4-pattern-box branch from 44d9ec5 to e4473ee Compare October 18, 2026 11:55
@shd101wyy
shd101wyy marked this pull request as ready for review October 18, 2026 11:55
@shd101wyy
shd101wyy force-pushed the feat/vbd-v4-pattern-box branch from e4473ee to 661efba Compare October 18, 2026 13:19
@shd101wyy
shd101wyy merged commit 9fb8817 into develop Oct 18, 2026
3 of 11 checks passed
@shd101wyy
shd101wyy deleted the feat/vbd-v4-pattern-box branch October 18, 2026 13:21
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.

1 participant