Skip to content

NFR burn-down: src/v2/compiler — translate-serialize-lowering (enumerate 33 typed-census wildcards) - #12667

Closed
gunbai-bot[bot] wants to merge 10 commits into
mainfrom
nfr/v2-compiler-translate-serialize-lowering
Closed

gunbai-bot[bot] wants to merge 10 commits into
mainfrom
nfr/v2-compiler-translate-serialize-lowering

Conversation

@gunbai-bot

@gunbai-bot gunbai-bot Bot commented Sep 29, 2026

Copy link
Copy Markdown
Contributor

Typed NFR census (artifact/nfr-typed-census-2a1dd41, checker #12610) burn-down for src/v2/compiler/, group 3 of 4.

Each _ => arm whose scrutinee is a closed coproduct is replaced by explicit arms for the remaining variants, each with the wildcard's body verbatim (the language has no or-patterns, so bodies are cloned). Where needed, the newly named constructors are added to the file's import list. No behaviour change and no refactor. No roster rows added; wildcards kept: none.

Files: src/v2/compiler/06_translate.dag src/v2/compiler/body_lowering_fold.dag src/v2/compiler/program_assembly.dag src/v2/compiler/program_partition.dag src/v2/compiler/target_serialize.dag

Verification: this PR's floor CI compiles and executes the claims (no local whole-corpus build per session policy).

🤖 Generated with Claude Code

gunbc-ci-auto-heal and others added 2 commits September 29, 2026 19:19
…/compiler, group 3)

Mechanical: each typed-census wildcard arm replaced by the explicit remaining
variants, each carrying the wildcard's body unchanged.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
body_lower_is_core_substrate: the leaf disjunction is body_lower_is_core_substrate_leaf,
called from each enumerated arm. conj_optional_named_child (06_translate) and
conj_named_child (target_serialize): each arm calls the existing
translate_grammar_inverse_not_realized_diagnostic instead of restating the literal.

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

gunbai-bot Bot commented Sep 29, 2026

Copy link
Copy Markdown
Contributor Author

Addressed review 72754 in 19d4379:

  • body_lower_is_core_substrate: the four-way disjunction now lives once, in body_lower_is_core_substrate_leaf(node), and each enumerated arm calls it.
  • conj_optional_named_child: rather than add a new helper, each arm now calls the existing target_serialize.translate_grammar_inverse_not_realized_diagnostic(emitted: parent), which builds the identical literal. That helper is imported, so the diagnostic has one authority instead of two. conj_named_child in target_serialize.dag had the same copied literal and now calls it too.

— sent from valiant-heron-154

gunbc-ci-auto-heal and others added 2 commits September 29, 2026 20:17
…tests through node_atom_identity_optional

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…ind decision is delegated

The tail-recursive grammar_tokens_fold_list_targets_into lowers to a loop whose match drops
nested TypeNode { connective: _ } arms (emit-build: E0004 on NodeKind::TypeNode). Per the NFR
ruling's self-call case, the decision moves to grammar_tokens_fold_list_shape and the walk keeps
its self-call over a two-variant step.

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

@briansrls briansrls left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

APPROVE at 3f8cb5b. The compiler partitions preserve the prior fallback results, the atom-kind probes are equivalently routed through node_atom_identity_optional, and repeated substrate behavior is delegated rather than duplicated. All four checks are currently queued or running, including floor, so this is a code approval only; landing remains conditional on the full check set completing green.

gunbc-ci-auto-heal and others added 2 commits September 29, 2026 22:15
…_operand_read_outcome upstream; take main's side)

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…-list step's stated reason (review 72905)

The tail-call match renderer does not drop nested arms: it emits them as guards, which rustc cannot
count toward exhaustiveness, where the ordinary renderer groups them (rc_grouped_arm_plan). Loud
(E0004), not silent. The row records mechanism, dormancy, and the next-rung trigger that dissolves
the need for grammar_tokens_fold_list_shape.

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

gunbai-bot Bot commented Sep 29, 2026

Copy link
Copy Markdown
Contributor Author

Re review 72905, addressed in 9622625:

  • The mechanism was misstated, and I've corrected it. I read v1.compiler.emit_rust. The tail-call match renderer (emit_rust_tco_match / emit_typed_tco_match_arm) does not drop arms. It emits each nested variant under an Rc field as a match guard (collect_pattern_rc_variant_guards), and rustc does not count guarded arms toward exhaustiveness. The ordinary renderer avoids this by grouping those arms into one nested match (rc_grouped_arm_plan, Emitter flattens nested constructor patterns: classify_arrow_body_form's Conj arm is unreachable in emitted Rust — a silent wrong answer, not a warning #8570); the loop path never consults that grouping. All arms are present and none selects wrongly. The failure is a loud E0004 at the target compiler, not §4b silent wrongness. The old comment in the code said "drops"; it now states the actual mechanism.
  • The class is now filed: dag/gunbc/recurring_failure_mode/tail_call_match_lowering_skips_rc_arm_grouping.dag. The row records the mechanism, why it was dormant (every such match ended in _ =>, which gave rustc an unguarded arm), rung and ceiling, and the next-rung trigger: emit_rust_tco_match consumes the same grouping authority, proven by an enumerated nested arm set in a tail-recursive fixture that emits and builds.
  • Why the step helper stays, rather than a seed-emitter fix in this PR. The helper is the form neat-boar-16's ruling for this lane prescribes for self-calling functions: delegate the decision to a helper and keep the self-call in the function. It is not a workaround that routes around a line-stop. It remains correct after the lowering is fixed; the row names the condition under which the need for it dissolves. The fix belongs in the v1 seed emitter plus regeneration of the stage0 mirror, which is outside this mechanical lane. I'm handing it off to the lane owner with the row as its brief.
  • Exposure elsewhere: the only exposed site in this PR's closure was this one; emit-build reported a single E0004. The other NFR PRs' emit-build runs will show any further tail-recursive sites, and each will get the same treatment.

— sent from valiant-heron-154

…t-koi-310 ruling)

No per-site workaround for tail_call_match_lowering_skips_rc_arm_grouping: the site keeps its
wildcard until the emitter root fix (adhoc-6e41e4c1-f65) lands. The RFM row records that disposition
and cites the site instead of the deleted helper.

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

gunbai-bot Bot commented Sep 29, 2026

Copy link
Copy Markdown
Contributor Author

In 3e8fbb2, per a ruling from silent-koi-310 on the tail-call emitter bug: grammar_tokens_fold_list_targets_into is back to its shape on main, wildcard included. The delegation helper existed only to avoid E0004, which makes it a §5 workaround. The root fix is a separate lane (work item adhoc-6e41e4c1-f65), and this site gets enumerated after it lands. The RFM row tail_call_match_lowering_skips_rc_arm_grouping stays and now records that disposition. This resolves the scaffold concern in review 72905.

— sent from valiant-heron-154

@briansrls briansrls left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

APPROVE at 3e8fbb2, conditional on the current emit-build completing green. The compiler enumerations and helper extractions are sound. One accounting correction is required for the joint activation: src/v2/compiler/target_serialize.dag::grammar_tokens_fold_list_targets_into deliberately retains its _ arm under the silent-koi-310 ruling because the tail-call renderer emits nested Rc-field arms as guards and rustc refuses E0004. The PR body therefore cannot say wildcards kept: none; carry this exact site as a retained NFR row in #12610's stack, with the recorded tail-call/Rc grouping dissolution trigger.

gunbc-ci-auto-heal added 3 commits September 30, 2026 09:27
# Conflicts:
#	dag/gunbc/recurring_failure_mode/tail_call_match_lowering_skips_rc_arm_grouping.dag
#	src/v2/compiler/body_lowering_fold.dag
# Conflicts:
#	src/v2/compiler/body_lowering_fold.dag
# Conflicts:
#	src/v2/compiler/body_lowering_fold.dag
@gunbai-bot

gunbai-bot Bot commented Oct 1, 2026

Copy link
Copy Markdown
Contributor Author

Consolidated into integration PR #12951 at the operator's request; this branch is merged there unchanged in its own merge commit. Closing here; the branch is kept. — sent from deep-ferret-305

@gunbai-bot gunbai-bot Bot closed this Oct 1, 2026
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