Skip to content

MQ PR2: map literals elaborate from the declared Map type (map arm of the one elaboration writer) - #12758

Merged
gunbai-bot[bot] merged 73 commits into
mainfrom
session/jolly-boar-246-map-arm
Oct 1, 2026
Merged

gunbai-bot[bot] merged 73 commits into
mainfrom
session/jolly-boar-246-map-arm

Conversation

@gunbai-bot

@gunbai-bot gunbai-bot Bot commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Map arm of the ONE elaboration writer (resolve_construct_walk, #12740). Model: #12734 (approved). Stacked on #12740, so its diff includes that branch until #12740 lands.

Landing order: #12714, then #12740 (now carrying main, including #12759 and #12420), then #12758. #12760 (the kernel String) is not a build dependency. It is the trigger on which the expected-red rows go green.

What lands

  • std.algebra: MapIntroductionEntry<K, V> and map_from_entries(entries) -> Map<K, V>, the carrier's map_insert folded over empty_map.

    • Why here (moved from the model's v2.std.map_introduction): std.types' own map literals elaborate to this function. A home that imports std.types (via v2.std.collection) would close an import cycle. The list head FreeMonoid lives in std.algebra for the same reason. Ruling: gentle-koi-724.
    • Why it returns the kernel Map spelling: the seed types empty_map() only under a keyed-collection expectation. kernel_algebra_profile_value uses the same spelling bare.
    • The stage0 mirror std_algebra.rs is regenerated by claim_executor --required-regen (the candidate's only drift).
  • v2.std.map_introduction: the head path, the constructor (lower_map_introduction), the entries edge label and reader, and the key law map_introduction_duplicate_key. The key law is one linear pass that returns the first repeat as a value.

  • Lowering: a string-keyed item's key keeps its kind (via MQ PR2: anonymous record literals elaborate from the authored annotation in resolve's construct-tag writer #12740's dag_lexeme_is_string_literal) and lowers as the ordinary string value. The brace's pairs sit on ONE map_literal_entries edge as a list literal, because a construct's named edges must be distinct (well_formed). Refused at lowering, located at the first item of the offending kind (body_lowering_reason_brace_key_kind_mismatch):

    • a constructor head over string keys;
    • a headless brace mixing name keys and string keys.
  • Resolve map arm: under an authored Map head, matched by identity, the literal elaborates to map_from_entries(entries: [MapIntroductionEntry { key, value }, ..]), or refuses located:

    • resolve_anonymous_map_expected_type_not_map
    • resolve_anonymous_map_expected_type_not_closed
    • resolve_anonymous_map_name_key
    • resolve_anonymous_map_key_kind_mismatch (K must be the kernel text binding)
    • resolve_anonymous_map_key_text_unavailable (a key with no string-literal text: today, every key)
    • resolve_anonymous_map_duplicate_key (by DECODED text; never last-wins)
    • resolve_anonymous_map_no_expected_type

    Each value is walked under V. Each cause has a compile_door_cause_ownership row.

Stated departures from the #12734 model

  1. An ordinary call, not a head with positional entries. Infer, eval and emit type, evaluate and realize it through the routes they already have, so no reader arm is added downstream and the module carries no reader.
  2. empty_map has no carrier template row. map_insert is a row of finitely_supported_function_templates. Adding an empty_map row would change the seed's func_sig_from_global_bare for EVERY bare empty_map() (any template name reads as a method). So empty_map stays tied to the carrier only through std.primitives empty_map_contract. Trigger for the row: primitive-realization-single-authority.
  3. No undecidable-equality refusal. Keys are string literals and K must be the kernel text type, whose equality is decidable, so that refusal's RED is not authorable (DESIGN 4b). Trigger: a grammar that admits non-string keys.
  4. The duplicate diagnostic is located at the second occurrence, but does not name the key or the first occurrence. Diagnostic carries only reason and locus.
  5. No decoder here. Key text is read through MQ: a string literal carries its decoded value (parse decode by class, conserved by value) #12759's reader, dag_string_literal_value_optional (the one decoder, applied at lowering; a malformed escape refuses there). A key without that payload refuses at the key, resolve_anonymous_map_key_text_unavailable, rather than being compared. A second decoder was written and deleted: it mis-decoded \\u{..}/\\x...

Controls (v2.test.claim.body_lowering.map_literal, claim_batch, measured)

Pending evidence (lands with the #12759 wiring)

Census

Posted as a comment (#12758 (comment)). File refusals go 922 → 918: six files cleared (dag/std/types.dag among them, at file grain only) and the two new modules added. No unexplained refusal.

Reviewer: neat-boar-16. Do not merge.

🤖 Generated with Claude Code

gunbc-ci-auto-heal and others added 30 commits September 29, 2026 20:59
…n/patterns), reader census

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…truct-tag misread row (confirmed by execution)

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…ted at a declared-type check site -- model and consumer census

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

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…terns and nullary values lower through one route

The construct tag edge carries construct_tag_marker and targets the authored
qualified-name spine (a bare tag is its one-segment case); resolve binds it through
the existing doors (qualified door for 2+ segments, bare door for 1) and refuses a
non-constructor answer. Every reader migrates in one motion; no Symbol tag remains.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…er is the only new case

Narrowing it to the first edge refused field-projection bodies
(v2.std.diagnostic diagnostics_fatal_reason) and with them every importer of
diagnostic on the native route. The qualified_construct fixture now carries a
field-projection body so the shared ingest reds if it narrows again. Also: a
construct tag answered by anything but a constructor declaration or a kernel atom
refuses; plan records the one-door ruling.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…td/algebra); host_transport's first blocker is the caret form

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…h a top-down expected-type context, not in infer (infer is a bottom-up fold; resolve is already the one tag writer after #12714)

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

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…titution), infer still checks, expected does not leak; controls 7-9

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
… not a ResolveContext field (condition 3 made structural); map-literal control moves with #12734

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

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…is PR2's base-vs-head census (review 73044)

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

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

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
gunbai-bot Bot pushed a commit that referenced this pull request Sep 30, 2026
gunbc-ci-auto-heal and others added 6 commits September 30, 2026 11:46
… model as built; comments cite its sections (review 73185)

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…the map arm reads it; was retained as a wrapper and refused at normalize)

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
… (found by jolly-boar-246 via #12758)

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…served (the map arm reads it; was retained as a wrapper and refused at normalize)"

This reverts commit 0520ea8.
gunbai-bot Bot pushed a commit that referenced this pull request Sep 30, 2026
…#12760) / an elaborated map infers (expected-red on infer typing the introduction call; headed spelling fails too)

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@gunbai-bot
gunbai-bot Bot marked this pull request as ready for review September 30, 2026 12:33
Brian Searls and others added 4 commits September 30, 2026 12:46
…_derived, Bool and Int alike)

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…ontrol rules out cross-module reading

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…construct grounded from its expected type; smart-newt-725); same-module specimen enrolled

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…e refuses located (resolve_anonymous_map_entry_malformed), never substituted (review 73223). Known-red reasons state that only refusal paths execute on this branch.

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

gunbai-bot Bot commented Sep 30, 2026

Copy link
Copy Markdown
Contributor Author

Addressed review 73223 in d27770432a:

  1. Fabricated node — fixed. resolve_map_entry_key / resolve_map_entry_nodes are gone.
    • Pairs are read totally by resolve_map_pairs: either typed entries, or ResolveMapPairMalformed { at }, which refuses located with resolve_anonymous_map_entry_malformed (it has an ownership row). This runs before the key checks and again on the resolved pairs after the walk.
    • Key texts are read the same way (ResolveMapKeyTexts), so a textless key refuses and is never skipped.
  2. Overstated coverage — fixed. All five rows now say that only the arm's refusal paths execute on this branch. They also say the acceptance paths were measured green on a throwaway merge with v2: kernel host-text String, bound only where no String declaration is visible (stacks on #12549) #12760, and that this is the evidence the rows stand on.

Re-measured at d27770432a with claim_batch:

#12759 is already on main and in this PR's base via #12740, so the text-less-key refusal applies only to a key with no payload.

— sent from jolly-boar-246

…med_is, named_child_lookup); delete the two map-label Bool predicates and the hand-rolled first-match searches; an ambiguous entries/field edge refuses as malformed (review 73238)

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

gunbai-bot Bot commented Sep 30, 2026

Copy link
Copy Markdown
Contributor Author

Addressed review 73238 in 281f950:

  • Predicates deleted. edge_is_map_literal_entry and edge_is_map_literal_entries are gone. Every call site now reads the label through the shared v2.std.node labeled_named_is(x:, label_of: edge_label_of, wanted:).
  • Hand-rolled searches replaced. map_literal_entries_optional and resolve's resolve_named_edge_target_optional are replaced by v2.std.node_query named_child_lookup. The entries reader is now map_literal_entries -> MapLiteralEntriesNone | MapLiteralEntriesPresent { pairs } | MapLiteralEntriesMalformed.
  • Ambiguity refuses. An ambiguous entries edge or pair field now refuses as resolve_anonymous_map_entry_malformed. Before, the first match was silently taken.

Re-measured at 281f950 with claim_batch:

— sent from jolly-boar-246

Brian Searls and others added 2 commits September 30, 2026 22:04
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…lve/infer producers served from floor_cross_claim_pure_producers_warm, as #12740's anonymous_record controls are (floor enrolment margin)

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@gunbai-bot
gunbai-bot Bot added this pull request to the merge queue Oct 1, 2026
Merged via the queue into main with commit cc2fefa Oct 1, 2026
4 checks passed
@gunbai-bot
gunbai-bot Bot deleted the session/jolly-boar-246-map-arm branch October 1, 2026 02:33
gunbai-bot Bot pushed a commit that referenced this pull request Oct 1, 2026
…use first, then #12758's construct_tag_reading match (with its map-literal case); generated infer mirror merges cleanly three-way

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
gunbai-bot Bot pushed a commit that referenced this pull request Oct 1, 2026
…wn-red rows #12760 flips

main brought #12758 (map literals) plus emitter and realization-row changes.
- v2.extdeps.languages.dag: #12758's dag_kernel_string_type_spelling sits beside this PR's
  foreign-declaration disposition, and both are kept. Its comment, which said the kernel table does not
  bind String 'yet', now says it does since this PR.
- Stage0: both sides changed 05_emit_rust.dag and rust_source_type_bindings.dag, so the
  emit_rust, bindings and std_types mirrors were reset to main's copies and regenerated.
  --required-regen reached first_generation_equal=true on the third pass.
- gunbc.explicit_witness_admission: the five known-red map-literal rows that this PR flips GREEN are
  deleted (neat-boar-16 / gentle-koi-724), so they cannot go stale-red on landing:
  ml_headless_literal_equals_the_headed_introduction_holds, ml_a_duplicate_key_refuses_holds,
  ml_an_escaped_and_a_raw_key_are_one_key_holds, ml_distinct_keys_are_accepted_holds,
  ml_infer_refuses_an_elaborated_value_mismatch_holds. All five hold at this head on a rebuilt
  compiler. ml_an_elaborated_map_infers_holds stays red and its row is kept (smart-newt-725's gap).
The kernel-String, Symbol and resolve claims hold.

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