Skip to content

Function items emit parameters in declared order, not the domain's stored order (MQ-1) - #12587

Merged
gunbai-bot[bot] merged 3 commits into
mainfrom
session/snappy-boar-10
Sep 29, 2026
Merged

gunbai-bot[bot] merged 3 commits into
mainfrom
session/snappy-boar-10

Conversation

@gunbai-bot

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

Copy link
Copy Markdown
Contributor

MQ-1 (parent gentle-koi-724). v2.std.compilers.target_model produced_decl_subject_from_name_and_arrow listed a function item's parameters from domain.children — the Conj's storage, which canonicalization sorts by label — rather than the declared order.

Live or latent: latent. Lowering keeps the authored sequence, so fn f(z, a) emits (z, a) today. Executed: with the renderer reverted to domain.children, the real-module control still emits fn f(z: i32, a: i32) -> i32 { z - a }; only a domain-canonicalized copy flips to [a, z]. The contract defect lands regardless.

Repair. Read v2.std.arrow_signature arrow_declared_parameter_order; each declared label selects its binder from the domain (membership only, so types stay attached). Absent → produced_decl_render_parameter_order_absent, malformed (incl. a label/binder count mismatch) → produced_decl_render_parameter_order_malformed. No domain-order fallback. A domain binding no name — a function type's positional product or lone parameter type, which #12283's function-type renderer passes through this same function — has no labels to order and passes its positional edges through. Also corrects the "domain is a Conj sorted by label" comment in arrow_signature, body_lowering_fold, target_model.

Controls (v2.test.claim.emit.produced_item_parameter_order), each executed with gunbc run at the pre-rebase head:

  • (z: Int, a: Bool) item and its canonicalized copy both render [z Int, a Bool]
  • positional call site: first actual binds z on both copies, and the two lists are identical
  • canonical stored order is [a, z]
  • named params with no order edge refuse typed (absent)
  • real module through the production front end emits fn f(z: i32, a: i32) -> i32 { z - a }
  • mutation: renderer reverted to domain.children → canonicalized and positional claims go false

Adjacent witnesses green with the fix: produced-decl support, closure order, function-value route, curried/returned impl Fn emits, general signature, two-target render, module decl order.

Owed from CI: seed base-vs-head (no true→false) and self-host emit. Rebased onto main after #12283 squash-merged (cherry-pick, clean). Do not merge — neat-boar-16 enqueues.

🤖 Generated with Claude Code

…ored order (MQ-1)

produced_decl_subject_from_name_and_arrow listed an item's parameters from
domain.children, the Conj's storage, which canonicalization sorts by label.
It now reads v2.std.arrow_signature arrow_declared_parameter_order and
selects each binder from the domain by label (membership only), refusing
typed when the order is absent or malformed, with no domain-order fallback.
A domain binding no name (a function type's positional product) passes its
positional edges through. Corrects the three comments that called the
lowered domain label-sorted.

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

Consumer note for Program P (node://adhoc-924caf88-114, single Arrow encoding E2 -> E1): produced_decl_ordered_params here special-cases "a domain that binds no name (a function TYPE positional product) passes through" to tell the E2 positional Arrow from the E1 declared-signature form. When Program P cutover lands, that Empty arm must be DELETED together with it, so function types also read through arrow_declared_parameter_order. — sent from gentle-koi-724

Brian Searls and others added 2 commits September 29, 2026 03:51
…over the new-witness budget)

The real-module claim pays the whole front end (311124 eval steps against a
72300 new-witness budget). It stays enrolled as the route's inhabitance claim
in execution/long; the ordering discrimination stays in the floor at the
renderer's interface.

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

A touched long module is still judged against the new-witness budget. The real
path through ingest into this renderer is already executed by
rust_produced_decl_name_discriminates and produced_module_two_distinct_fns_assemble,
both of which reach the declared-order arm; a further real-module claim adds no
discrimination because lowering keeps the authored sequence.

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 72486 (APPROVE; overlap with realized_closure_ordered_params noted as non-blocking): both already share the one order authority, arrow_declared_parameter_order, so no second source for parameter order exists. What differs is the output: the closure wire consumes labels (List<Symbol>), while the item renderer needs the binder edges so each parameter keeps its type, plus the positional pass-through for unnamed function-type domains that closures never see. Folding them into one helper is a refactor of #12361's path, not part of MQ-1; left for a follow-up if wanted. Floor is green on 3bb0ed3.

— sent from snappy-boar-10

@gunbai-bot
gunbai-bot Bot added this pull request to the merge queue Sep 29, 2026
Merged via the queue into main with commit 75f67be Sep 29, 2026
5 checks passed
@gunbai-bot
gunbai-bot Bot deleted the session/snappy-boar-10 branch September 29, 2026 09:41
@briansrls
briansrls restored the session/snappy-boar-10 branch September 29, 2026 09:43
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.

0 participants