From 3896660fe46038e9f0b9f0a5f0f1a426a5f8addb Mon Sep 17 00:00:00 2001 From: gunbc-ci-auto-heal Date: Sun, 4 Oct 2026 07:10:19 +0000 Subject: [PATCH 1/5] C3: the empty-map turbofish renders in the enclosing fn's generic scope rust_empty_map_kv_type_str rendered key and value through render_rust_type with an empty emit info, so a fn-scope generic rendered by its erased inference (std.list duplicated_by_key: rc_empty_map::). Now through render_rust_arrow_position, as the arrow positions already are. Co-Authored-By: Claude Opus 5.5 (1M context) --- .../instruments/native_emission_controls.dag | 24 ++++++++++++++++++- src/v1/05_emit_rust.dag | 20 +++++++++++----- 2 files changed, 37 insertions(+), 7 deletions(-) diff --git a/dag/gunbc/instruments/native_emission_controls.dag b/dag/gunbc/instruments/native_emission_controls.dag index dc95e36f008..de101492b55 100644 --- a/dag/gunbc/instruments/native_emission_controls.dag +++ b/dag/gunbc/instruments/native_emission_controls.dag @@ -2,6 +2,7 @@ module gunbc.instruments.native_emission_controls import std.types { Bool, Int, List, Set, String } import v2.std.algebra { filter } +import std.list { duplicated_by_key } import extdeps.filesystem.filesystem_io { Filesystem } import std.compiler_entry { CompilerEntryDriver, NativeClaimDriver, NativeClaimReport, NativeClaimTerminal, NativeClaimHeld, NativeClaimNotHeld } @@ -147,6 +148,25 @@ fn claim_driver_filesystem_cases() -> List { ] } +// RULE: an empty-map turbofish renders in the enclosing fn's generic scope (v1.compiler.emit_rust +// rust_empty_map_kv_type_str through render_rust_arrow_position). std.list duplicated_by_key builds +// `DuplicatedScan { firsts: empty_map(), .. }` whose field is `Map`; the T rendered by its +// erased inference as a compile_error!, so std.list did not compile. The cases call the real kernel: +// each repeated key's FIRST element once, in the order the keys were found to repeat, and nothing +// for a list without repeats. +fn generic_empty_map_turbofish_cases() -> List { + [ + NativeEmissionCase { + identity: "generic_empty_map_duplicated_by_key_reports_each_repeat_once", + held: duplicated_by_key(xs: ["a", "b", "a", "c", "b", "a"], key: x => x) == ["a", "b"] + }, + NativeEmissionCase { + identity: "generic_empty_map_red_no_repeat_reports_nothing", + held: duplicated_by_key(xs: ["a", "b", "c"], key: x => x) == [] + } + ] +} + data native_emission_expected_identities: List = [ "set_struct_eq_same_members_in_another_order", "set_struct_eq_red_bare_field_differs", @@ -163,11 +183,13 @@ data native_emission_expected_identities: List = [ "filter_guard_receipt_blank_tail_accepts", "filter_guard_receipt_red_nonblank_tail_refuses", "filter_guard_receipt_red_empty_tag_short_circuits", + "generic_empty_map_duplicated_by_key_reports_each_repeat_once", + "generic_empty_map_red_no_repeat_reports_nothing", "claim_driver_filesystem_absent_path_read_is_refused" ] fn native_emission_cases() -> List { - concat(concat(header_bound_cases(), filter_in_branch_condition_cases()), claim_driver_filesystem_cases()) + concat(concat(concat(header_bound_cases(), filter_in_branch_condition_cases()), claim_driver_filesystem_cases()), generic_empty_map_turbofish_cases()) } fn case_row(c: NativeEmissionCase) -> String { diff --git a/src/v1/05_emit_rust.dag b/src/v1/05_emit_rust.dag index 627621e927e..be45fc67177 100644 --- a/src/v1/05_emit_rust.dag +++ b/src/v1/05_emit_rust.dag @@ -11106,22 +11106,30 @@ fn rust_runtime_bridge_name(function_name: String) -> String { } } -fn rust_empty_map_value_type_str(map_type: Node, shared_types: Set, source_indices: Map) -> String { +// THE EMPTY-MAP TURBOFISH RENDERS ITS KEY AND VALUE IN THE ENCLOSING FN'S GENERIC SCOPE, through +// render_rust_arrow_position -- the renderer render_rust_arrow_position's own note already moved the +// arrow positions onto, for the same defect. Through render_rust_type with an empty emit info a +// fn-scope generic rendered by its erased inference: std.list duplicated_by_key's +// `DuplicatedScan { firsts: empty_map(), .. }`, a field typed `Map`, emitted +// `rc_empty_map::()`, and the record then +// inferred as `DuplicatedScan<()>` (E0308 `Vector<()>` vs `Vector` at the reverse). A concrete +// field such as `Map` rendered the same either way. +fn rust_empty_map_value_type_str(map_type: Node, shared_types: Set, source_indices: Map, emit_info: EmitGraphInfo) -> String { match map_type.children |> skip(1) |> first { Present { value: value_child } => - let rendered = render_rust_type(n: child_type_node(ch: value_child), shared_types: shared_types, source_indices: source_indices, emit_info: empty_emit_graph_info()) + let rendered = render_rust_arrow_position(n: child_type_node(ch: value_child), shared_types: shared_types, source_indices: source_indices, emit_info: emit_info) if rendered == "" { "" } else { rendered } Absent => "" } } -fn rust_empty_map_kv_type_str(map_type: Node, shared_types: Set, source_indices: Map) -> String { +fn rust_empty_map_kv_type_str(map_type: Node, shared_types: Set, source_indices: Map, emit_info: EmitGraphInfo) -> String { let key_str = match map_type.children |> first { Present { value: key_child } => - render_rust_type(n: child_type_node(ch: key_child), shared_types: shared_types, source_indices: source_indices, emit_info: empty_emit_graph_info()) + render_rust_arrow_position(n: child_type_node(ch: key_child), shared_types: shared_types, source_indices: source_indices, emit_info: emit_info) Absent => "" } - let val_str = rust_empty_map_value_type_str(map_type: map_type, shared_types: shared_types, source_indices: source_indices) + let val_str = rust_empty_map_value_type_str(map_type: map_type, shared_types: shared_types, source_indices: source_indices, emit_info: emit_info) if key_str != "" && val_str != "" { concat(key_str, ", ", val_str) } else { "" } @@ -11138,7 +11146,7 @@ fn rust_empty_map_kv_type_str(map_type: Node, shared_types: Set, source_ // all. Two sites asking one question is the second representation DESIGN section 2 forbids, so the // question is asked once, here, and both sites read the answer. fn rust_empty_map_init_expr(map_type: Node, shared_types: Set, source_indices: Map, emit_info: EmitGraphInfo) -> String { - let kv_type_str = rust_empty_map_kv_type_str(map_type: map_type, shared_types: shared_types, source_indices: source_indices) + let kv_type_str = rust_empty_map_kv_type_str(map_type: map_type, shared_types: shared_types, source_indices: source_indices, emit_info: emit_info) if kv_type_str == "" { rust_shared_wrap_ctor(inner_expr: "HashMap::new() /* BRIDGE: empty_map value type unresolved */") } else if rust_fold_rendered_type_has_any_spurious_generic(type_str: concat("<", kv_type_str, ">"), generic_param_names: emit_info.fn_generic_param_names) { From 9ce598e7ce7bb2b271f78cf1f312228ebdd57a5c Mon Sep 17 00:00:00 2001 From: gunbc-ci-auto-heal Date: Sun, 4 Oct 2026 07:40:12 +0000 Subject: [PATCH 2/5] C3: an erased empty-map type argument defers to the target's inference Replaces the generic-scope render, which had no effect: the turbofish type arrives erased from infer (generic record instantiation at an unannotated literal), so no renderer can name it. It now declines to ::<_, _>() as an unbound formal already does. Co-Authored-By: Claude Opus 5.5 (1M context) --- src/v1/05_emit_rust.dag | 40 +++++++++++++++++++++++++--------------- 1 file changed, 25 insertions(+), 15 deletions(-) diff --git a/src/v1/05_emit_rust.dag b/src/v1/05_emit_rust.dag index be45fc67177..232c53a0012 100644 --- a/src/v1/05_emit_rust.dag +++ b/src/v1/05_emit_rust.dag @@ -11106,30 +11106,22 @@ fn rust_runtime_bridge_name(function_name: String) -> String { } } -// THE EMPTY-MAP TURBOFISH RENDERS ITS KEY AND VALUE IN THE ENCLOSING FN'S GENERIC SCOPE, through -// render_rust_arrow_position -- the renderer render_rust_arrow_position's own note already moved the -// arrow positions onto, for the same defect. Through render_rust_type with an empty emit info a -// fn-scope generic rendered by its erased inference: std.list duplicated_by_key's -// `DuplicatedScan { firsts: empty_map(), .. }`, a field typed `Map`, emitted -// `rc_empty_map::()`, and the record then -// inferred as `DuplicatedScan<()>` (E0308 `Vector<()>` vs `Vector` at the reverse). A concrete -// field such as `Map` rendered the same either way. -fn rust_empty_map_value_type_str(map_type: Node, shared_types: Set, source_indices: Map, emit_info: EmitGraphInfo) -> String { +fn rust_empty_map_value_type_str(map_type: Node, shared_types: Set, source_indices: Map) -> String { match map_type.children |> skip(1) |> first { Present { value: value_child } => - let rendered = render_rust_arrow_position(n: child_type_node(ch: value_child), shared_types: shared_types, source_indices: source_indices, emit_info: emit_info) + let rendered = render_rust_type(n: child_type_node(ch: value_child), shared_types: shared_types, source_indices: source_indices, emit_info: empty_emit_graph_info()) if rendered == "" { "" } else { rendered } Absent => "" } } -fn rust_empty_map_kv_type_str(map_type: Node, shared_types: Set, source_indices: Map, emit_info: EmitGraphInfo) -> String { +fn rust_empty_map_kv_type_str(map_type: Node, shared_types: Set, source_indices: Map) -> String { let key_str = match map_type.children |> first { Present { value: key_child } => - render_rust_arrow_position(n: child_type_node(ch: key_child), shared_types: shared_types, source_indices: source_indices, emit_info: emit_info) + render_rust_type(n: child_type_node(ch: key_child), shared_types: shared_types, source_indices: source_indices, emit_info: empty_emit_graph_info()) Absent => "" } - let val_str = rust_empty_map_value_type_str(map_type: map_type, shared_types: shared_types, source_indices: source_indices, emit_info: emit_info) + let val_str = rust_empty_map_value_type_str(map_type: map_type, shared_types: shared_types, source_indices: source_indices) if key_str != "" && val_str != "" { concat(key_str, ", ", val_str) } else { "" } @@ -11145,11 +11137,29 @@ fn rust_empty_map_kv_type_str(map_type: Node, shared_types: Set, source_ // a module-scope `data ...: Map = empty_map()` in a module with no generic scope at // all. Two sites asking one question is the second representation DESIGN section 2 forbids, so the // question is asked once, here, and both sites read the answer. +// AN ERASED TYPE ARGUMENT DECLINES TO THE TARGET'S INFERENCE, EXACTLY AS AN UNBOUND FORMAL DOES. The +// arm above already defers `::<_, _>()` when the emitter cannot name the formals in this fn's scope. +// A key or value whose inferred node is a compiler error is the same state seen one stage earlier: +// v1.compiler.infer does not bind a generic record's parameter at an unannotated record literal +// (std.list duplicated_by_key's `DuplicatedScan { firsts: empty_map(), .. }` inside a fold), so the +// field type arrives erased and rendered as `compile_error!("UNRESOLVED_CompilerError")`. Rendering +// that refusal is what rust_witness_carrier_from_type_node's note forbids -- an erased first source +// must decline so the next authority is consulted -- and here the next authority is rustc, which +// infers T from the field's later `map_insert` or refuses loudly; nothing is widened. The upstream +// boundary stays open and is named, not absorbed: generic record instantiation at infer +// (declared_type_conformance_note's "generic record instantiation" lane). +fn type_node_carries_erased_type_argument(n: Node) -> Bool { + n.children |> any(c => + let t = child_type_node(ch: c) + (t.inferred != none && is_compiler_error(inferred: t.inferred.value)) || type_node_carries_erased_type_argument(n: t)) +} + fn rust_empty_map_init_expr(map_type: Node, shared_types: Set, source_indices: Map, emit_info: EmitGraphInfo) -> String { - let kv_type_str = rust_empty_map_kv_type_str(map_type: map_type, shared_types: shared_types, source_indices: source_indices, emit_info: emit_info) + let kv_type_str = rust_empty_map_kv_type_str(map_type: map_type, shared_types: shared_types, source_indices: source_indices) if kv_type_str == "" { rust_shared_wrap_ctor(inner_expr: "HashMap::new() /* BRIDGE: empty_map value type unresolved */") - } else if rust_fold_rendered_type_has_any_spurious_generic(type_str: concat("<", kv_type_str, ">"), generic_param_names: emit_info.fn_generic_param_names) { + } else if rust_fold_rendered_type_has_any_spurious_generic(type_str: concat("<", kv_type_str, ">"), generic_param_names: emit_info.fn_generic_param_names) + || type_node_carries_erased_type_argument(n: map_type) { "v1_rt::rc_empty_map::<_, _>()" } else { concat("v1_rt::rc_empty_map::<", kv_type_str, ">()") From fd5ee603ec7051261eedba6729de35f5d496f0ab Mon Sep 17 00:00:00 2001 From: gunbc-ci-auto-heal Date: Sun, 4 Oct 2026 08:08:58 +0000 Subject: [PATCH 3/5] C3: regenerated v1_compiler_emit_rust.rs Co-Authored-By: Claude Opus 5.5 (1M context) --- src/v1/stage0/src/v1_compiler_emit_rust.rs | 23 ++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/src/v1/stage0/src/v1_compiler_emit_rust.rs b/src/v1/stage0/src/v1_compiler_emit_rust.rs index 0994f20b173..622e7691bfe 100644 --- a/src/v1/stage0/src/v1_compiler_emit_rust.rs +++ b/src/v1/stage0/src/v1_compiler_emit_rust.rs @@ -23774,6 +23774,24 @@ pub fn rust_empty_map_kv_type_str( } } +pub fn type_node_carries_erased_type_argument(n: Rc) -> bool { + stacker::maybe_grow(512 * 1024, 2 * 1024 * 1024, || { + let mut __found = false; + for c in n.children.clone().iter().cloned() { + if { + let t = crate::v1_compiler_infer_types::child_type_node(c.clone()); + (((t.inferred.clone() != std::option::Option::None) + && crate::v1_std_core::is_compiler_error(t.inferred.clone().clone().unwrap())) + || type_node_carries_erased_type_argument(t.clone())) + } { + __found = true; + break; + } + } + __found + }) +} + pub fn rust_empty_map_init_expr( map_type: Rc, shared_types: Rc>, @@ -23791,13 +23809,14 @@ pub fn rust_empty_map_init_expr( "HashMap::new() /* BRIDGE: empty_map value type unresolved */".to_string(), ) } else { - if rust_fold_rendered_type_has_any_spurious_generic( + if (rust_fold_rendered_type_has_any_spurious_generic( v1_rt::concat( v1_rt::concat("<".to_string(), kv_type_str.clone()), ">".to_string(), ), emit_info.fn_generic_param_names.clone(), - ) { + ) || type_node_carries_erased_type_argument(map_type.clone())) + { "v1_rt::rc_empty_map::<_, _>()".to_string() } else { v1_rt::concat( From c6fc91339f7ec96bd8bd8a6e6fa1319c4edd6ffb Mon Sep 17 00:00:00 2001 From: gunbc-ci-auto-heal Date: Mon, 5 Oct 2026 16:37:12 +0000 Subject: [PATCH 4/5] C3: regenerate v1_compiler_emit_rust.rs over merged main (batch 2; fixed point) Co-Authored-By: Claude Opus 5.5 (1M context) --- src/v1/stage0/src/v1_compiler_emit_rust.rs | 23 ++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/src/v1/stage0/src/v1_compiler_emit_rust.rs b/src/v1/stage0/src/v1_compiler_emit_rust.rs index d6596625f51..b84b9fe119a 100644 --- a/src/v1/stage0/src/v1_compiler_emit_rust.rs +++ b/src/v1/stage0/src/v1_compiler_emit_rust.rs @@ -24483,6 +24483,24 @@ pub fn rust_empty_map_kv_type_str( } } +pub fn type_node_carries_erased_type_argument(n: Rc) -> bool { + stacker::maybe_grow(512 * 1024, 2 * 1024 * 1024, || { + let mut __found = false; + for c in n.children.clone().iter().cloned() { + if { + let t = crate::v1_compiler_infer_types::child_type_node(c.clone()); + (((t.inferred.clone() != std::option::Option::None) + && crate::v1_std_core::is_compiler_error(t.inferred.clone().clone().unwrap())) + || type_node_carries_erased_type_argument(t.clone())) + } { + __found = true; + break; + } + } + __found + }) +} + pub fn rust_empty_map_init_expr( map_type: Rc, shared_types: Rc>, @@ -24500,13 +24518,14 @@ pub fn rust_empty_map_init_expr( "HashMap::new() /* BRIDGE: empty_map value type unresolved */".to_string(), ) } else { - if rust_fold_rendered_type_has_any_spurious_generic( + if (rust_fold_rendered_type_has_any_spurious_generic( v1_rt::concat( v1_rt::concat("<".to_string(), kv_type_str.clone()), ">".to_string(), ), emit_info.fn_generic_param_names.clone(), - ) { + ) || type_node_carries_erased_type_argument(map_type.clone())) + { "v1_rt::rc_empty_map::<_, _>()".to_string() } else { v1_rt::concat( From 24aeac32daf668bc56ad5ffe432ce6127a3ad7a4 Mon Sep 17 00:00:00 2001 From: gunbc-ci-auto-heal Date: Mon, 5 Oct 2026 20:04:31 +0000 Subject: [PATCH 5/5] C3: regenerate v1_compiler_emit_rust.rs over merged main (fixed point) Co-Authored-By: Claude Opus 5.5 (1M context) --- src/v1/stage0/src/v1_compiler_emit_rust.rs | 23 ++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/src/v1/stage0/src/v1_compiler_emit_rust.rs b/src/v1/stage0/src/v1_compiler_emit_rust.rs index f2e9fe6fcbf..9e460127f5e 100644 --- a/src/v1/stage0/src/v1_compiler_emit_rust.rs +++ b/src/v1/stage0/src/v1_compiler_emit_rust.rs @@ -24825,6 +24825,24 @@ pub fn rust_empty_map_kv_type_str( } } +pub fn type_node_carries_erased_type_argument(n: Rc) -> bool { + stacker::maybe_grow(512 * 1024, 2 * 1024 * 1024, || { + let mut __found = false; + for c in n.children.clone().iter().cloned() { + if { + let t = crate::v1_compiler_infer_types::child_type_node(c.clone()); + (((t.inferred.clone() != std::option::Option::None) + && crate::v1_std_core::is_compiler_error(t.inferred.clone().clone().unwrap())) + || type_node_carries_erased_type_argument(t.clone())) + } { + __found = true; + break; + } + } + __found + }) +} + pub fn rust_empty_map_init_expr( map_type: Rc, shared_types: Rc>, @@ -24842,13 +24860,14 @@ pub fn rust_empty_map_init_expr( "HashMap::new() /* BRIDGE: empty_map value type unresolved */".to_string(), ) } else { - if rust_fold_rendered_type_has_any_spurious_generic( + if (rust_fold_rendered_type_has_any_spurious_generic( v1_rt::concat( v1_rt::concat("<".to_string(), kv_type_str.clone()), ">".to_string(), ), emit_info.fn_generic_param_names.clone(), - ) { + ) || type_node_carries_erased_type_argument(map_type.clone())) + { "v1_rt::rc_empty_map::<_, _>()".to_string() } else { v1_rt::concat(