diff --git a/dag/gunbc/plans/dag_v2_defork_audit.dag b/dag/gunbc/plans/dag_v2_defork_audit.dag index 567c3b0a328..27d773cf0c9 100644 --- a/dag/gunbc/plans/dag_v2_defork_audit.dag +++ b/dag/gunbc/plans/dag_v2_defork_audit.dag @@ -108,10 +108,10 @@ fn dag_v2_defork_audit_body() -> List { li(text: "**Root B — generic-inference keystone + de-fork (THIS lane).** Phased, in order:"), ]), ol(items: [ - li(text: "**Keystone first:** fix v2 generic-alias instantiation so `type X = FreeMonoid` resolves (today it fails *\"variant not found in type FreeMonoid\"* at the definition site — `src/v2/std/qualified_name.dag`, `catalog.dag` `fold_list`, `ParseTable`). This is load-bearing resolver/infer work (`03_resolve`/`04_infer`) — model-before-implement, escalate before touching under any pre-dating brief."), + li(text: "**Keystone (partially landed via #5552):** simple generic-alias instantiation resolves — `type X = FreeMonoid` defines and construct/match/use-site works (proven by `generic_alias_coproduct_instantiation_test.dag`); `qualified_name.dag` is fully dissolved (incl. the v1 seed host-builtins made generic — `free_monoid_symbol_*`). **Still open:** raw variant-matching a value bound from a recursive `Cons.tail` field still fails *\"variant not found in type FreeMonoid\"* (`04_infer` fixpoint gap) — consumers avoid it via the `list_head`/algebra idiom; `catalog.dag` `fold_list`/`ParseTable` still await it. This residue is load-bearing resolver/infer work (`03_resolve`/`04_infer`) — model-before-implement, escalate before touching under any pre-dating brief."), li(text: "**Definition unification:** make the coproduct the single authority in `std/algebra.dag`, delete the dag record-of-methods *definition* (re-express its surface as inhabitance), introduce the aliases. Only after the keystone lands (so the aliases compile). jolly-cat's Root A emit-seam should already be in by here — coordinate the `algebra.dag` touch."), li(text: "**Repoints** (mechanical once 1–2 land): `nat`/`integer`/`float` (numeric tower `Int = GroupCompletion`), `logic`, `effects` (operation-axis ⊕ idempotency-axis grounding), `verification` (entangled with #5428 + `Value::Null` — may stay last). Per the #5511 per-concept census above."), - li(text: "**Dissolve the 🟡 markers:** `qualified_name.dag` (`QnEmpty/QnCons` → `Empty/Cons`, `qualified_name_eq/for_all/singleton` → FreeMonoid ops), `catalog.dag` `fold_list`. The self_gen8 3 ignores fold into the def-unification PR — their premise flips from \"stays_unemitted\" to \"expects grounded `List=Vec` emission\" (`node://adhoc-9d2bb9c3-e7b`)."), + li(text: "**Dissolve the 🟡 markers:** `qualified_name.dag` — **DONE** (`QnEmpty/QnCons` → `Empty/Cons`, `qualified_name_eq/for_all/singleton` → FreeMonoid ops + structural `==`, v1 seed bridge made generic); `catalog.dag` `fold_list` still awaits the recursive-tail resolver residue. The self_gen8 3 ignores fold into the def-unification PR — their premise flips from \"stays_unemitted\" to \"expects grounded `List=Vec` emission\" (`node://adhoc-9d2bb9c3-e7b`)."), ]), h3(text: "Fences (DESIGN §3/§6, and the #5516 respawn-mandate lesson)"), ul(items: [ diff --git a/docs/plans/dag-v2-defork-audit.md b/docs/plans/dag-v2-defork-audit.md index 2480856fad0..67f22c57a9d 100644 --- a/docs/plans/dag-v2-defork-audit.md +++ b/docs/plans/dag-v2-defork-audit.md @@ -141,7 +141,7 @@ The operator ruled the FreeMonoid/algebra single authority that category (b) was - **Root A — grounding (jolly-cat owns, build-now).** The `src/v1/05_emit_rust.dag` emit-seam (`rust_seed_host_container_base`/`rust_named_type_base`/`rust_corpus_repr`) generalized to String/FreeMonoid → host `Vec`. **Emit-layer only — does NOT change `std/algebra.dag` definitions**, so it runs concurrently with Root B without conflict. Kills ~48% of the 16,071 self-host cargo errors (String+List). The carrier-independent tail (import-dedup E0252, closure-Debug) rides here too. - **Root B — generic-inference keystone + de-fork (THIS lane).** Phased, in order: -1. **Keystone first:** fix v2 generic-alias instantiation so `type X = FreeMonoid` resolves (today it fails *"variant not found in type FreeMonoid"* at the definition site — `src/v2/std/qualified_name.dag`, `catalog.dag` `fold_list`, `ParseTable`). This is load-bearing resolver/infer work (`03_resolve`/`04_infer`) — model-before-implement, escalate before touching under any pre-dating brief. +1. **Keystone (partially landed via #5552):** simple generic-alias instantiation now resolves — `type X = FreeMonoid` defines and construct/match/use-site works (proven by `generic_alias_coproduct_instantiation_test.dag`), and the `QualifiedName` hand-roll is dissolved (QnEmpty/QnCons → Empty/Cons, trio → FreeMonoid ops + `==`, incl. the v1 seed host-builtins made generic). **Still open:** raw variant-matching a value bound from a recursive `Cons.tail` field still fails *"variant not found in type FreeMonoid"* (`04_infer` fixpoint gap) — consumers avoid it via the `list_head`/algebra idiom; `catalog.dag` `fold_list`/`ParseTable` still await it. This residue is load-bearing resolver/infer work (`03_resolve`/`04_infer`) — model-before-implement, escalate before touching under any pre-dating brief. 2. **Definition unification:** make the coproduct the single authority in `std/algebra.dag`, delete the dag record-of-methods *definition* (re-express its surface as inhabitance), introduce the aliases. Only after the keystone lands (so the aliases compile). jolly-cat's Root A emit-seam should already be in by here — coordinate the `algebra.dag` touch. 3. **Repoints** (mechanical once 1–2 land): `nat`/`integer`/`float` (numeric tower `Int = GroupCompletion`), `logic`, `effects` (operation-axis ⊕ idempotency-axis grounding), `verification` (entangled with #5428 + `Value::Null` — may stay last). Per the #5511 per-concept census above. 4. **Dissolve the 🟡 markers:** `qualified_name.dag` (`QnEmpty/QnCons` → `Empty/Cons`, `qualified_name_eq/for_all/singleton` → FreeMonoid ops), `catalog.dag` `fold_list`. The self_gen8 3 ignores fold into the def-unification PR — their premise flips from "stays_unemitted" to "expects grounded `List=Vec` emission" (`node://adhoc-9d2bb9c3-e7b`). diff --git a/docs/plans/fold-ergonomics.md b/docs/plans/fold-ergonomics.md index 663bba01d5e..cc89ba42a38 100644 --- a/docs/plans/fold-ergonomics.md +++ b/docs/plans/fold-ergonomics.md @@ -31,7 +31,7 @@ The fold is not aspirational here — it is the actual architecture, at scale: **Root B — generic inference is weak, so the fold is awkward to reach (the friction).** Two concrete failures: - generic fn-param results mis-infer as kernel `Witness`/`Optional` → must route through a typed param (the `resolve_probe` workaround in `staging.dag`; same in `target_model.dag`); -- generic type-alias instantiation fails — `type QualifiedName = FreeMonoid` won't define ("variant not found in type `FreeMonoid`") → **55 lines of hand-rolled `qualified_name_eq`/`for_all`** (`qualified_name.dag:25–57`), and it is the *same* root that makes v2 still hand-roll `ParseTable`. +- generic type-alias instantiation — **partially fixed by #5552**: `type QualifiedName = FreeMonoid` now defines, and simple construct/match/use-site instantiation resolves (proven by `generic_alias_coproduct_instantiation_test.dag`); the hand-rolled `qualified_name_eq`/`for_all`/`singleton` were dissolved into `FreeMonoid` ops + structural `==` (QualifiedName seed de-fork). **Remaining resolver gap:** raw variant-matching a value *bound from a `Cons.tail` field* (or a nested `tail: Empty` pattern) on a recursive `FreeMonoid` still corrupts resolution ("variant not found in type `FreeMonoid`") — thread tails through the algebra (`list_head`/`list_tail`/`fold`) instead, the idiom all `FreeMonoid` consumers already use. It is the *same* root that makes v2 still hand-roll `ParseTable`. Root A is the fail-open class the lane retires; Root B is the friction that keeps producing it. diff --git a/src/v1/stage0/src/cli_run.rs b/src/v1/stage0/src/cli_run.rs index f75b159a976..0ae196d23fd 100644 --- a/src/v1/stage0/src/cli_run.rs +++ b/src/v1/stage0/src/cli_run.rs @@ -375,28 +375,28 @@ pub fn source_path_for_module_path(module_path: String) -> String { .unwrap_or_else(|| panic!("module_path_index: unknown module path '{module_path}'")) } -pub fn qualified_name_value_to_module_path(value: &v1_interpreter::Value) -> String { - v1_interpreter::qualified_name_value_to_module_path(value) +pub fn free_monoid_symbol_value_to_dotted_string(value: &v1_interpreter::Value) -> String { + v1_interpreter::free_monoid_symbol_value_to_dotted_string(value) } -pub fn qualified_name_value_from_dotted_string( +pub fn free_monoid_symbol_value_from_dotted_string( ctx: &v1_interpreter::InterpContext, dotted: &str, ) -> v1_interpreter::Value { use v1_interpreter::{sorted_fields, Value}; - let qn_variant = |variant: &str, fields: Vec<_>| Value::Variant { - type_name: ctx.sym("QualifiedName"), + let fm_variant = |variant: &str, fields: Vec<_>| Value::Variant { + type_name: ctx.sym("FreeMonoid"), variant_name: ctx.sym(variant), fields: Rc::new(fields), }; if dotted.is_empty() { - return qn_variant("QnEmpty", vec![]); + return fm_variant("Empty", vec![]); } - let mut qn = qn_variant("QnEmpty", vec![]); + let mut qn = fm_variant("Empty", vec![]); for seg in dotted.split('.').rev() { - qn = qn_variant( - "QnCons", + qn = fm_variant( + "Cons", sorted_fields(vec![ (ctx.sym("head"), Value::Str(seg.to_string())), (ctx.sym("tail"), qn), @@ -5985,13 +5985,13 @@ pub fn parse_source_root_entry_admission(source: &str) -> Result String { +fn free_monoid_symbol_emit_dag(segments: &[String]) -> String { if segments.is_empty() { - return "QnEmpty".to_string(); + return "Empty".to_string(); } - let mut out = String::from("QnEmpty"); + let mut out = String::from("Empty"); for seg in segments.iter().rev() { - out = format!("QnCons {{ head: ^{seg}, tail: {out} }}"); + out = format!("Cons {{ head: ^{seg}, tail: {out} }}"); } out } @@ -5999,20 +5999,20 @@ fn emit_qualified_name_dag(segments: &[String]) -> String { #[cfg(test)] mod manifest_emit_tests { use super::{ - dag_embedded_dag_source_escape, dag_manifest_scalar_escape, emit_qualified_name_dag, + dag_embedded_dag_source_escape, dag_manifest_scalar_escape, free_monoid_symbol_emit_dag, }; #[test] - fn emit_qualified_name_dag_three_segment_path() { + fn free_monoid_symbol_emit_dag_three_segment_path() { assert_eq!( - emit_qualified_name_dag(&["v2".into(), "compiler".into(), "compile".into()]), - "QnCons { head: ^v2, tail: QnCons { head: ^compiler, tail: QnCons { head: ^compile, tail: QnEmpty } } }" + free_monoid_symbol_emit_dag(&["v2".into(), "compiler".into(), "compile".into()]), + "Cons { head: ^v2, tail: Cons { head: ^compiler, tail: Cons { head: ^compile, tail: Empty } } }" ); } #[test] - fn emit_qualified_name_dag_empty_is_qn_empty() { - assert_eq!(emit_qualified_name_dag(&[]), "QnEmpty"); + fn free_monoid_symbol_emit_dag_empty_is_empty_variant() { + assert_eq!(free_monoid_symbol_emit_dag(&[]), "Empty"); } #[test] @@ -6092,7 +6092,7 @@ fn emit_import_admission_list(imports: &[Vec]) -> String { for import in imports.iter().rev() { out = format!( "Cons {{\n head: Import {{\n target: {},\n visibility: ImportVisible\n }},\n tail: {out}\n}}", - emit_qualified_name_dag(import) + free_monoid_symbol_emit_dag(import) ); } out @@ -6101,7 +6101,7 @@ fn emit_import_admission_list(imports: &[Vec]) -> String { fn emit_source_root_entry_admission_data(admission: &SourceRootEntryAdmission) -> String { format!( "data host_compiler_closure_admission: Admission = Admission {{\n subject: ResolutionSubject {{\n name: {}\n }},\n imports: {}\n}}\n\n\n", - emit_qualified_name_dag(&admission.subject), + free_monoid_symbol_emit_dag(&admission.subject), emit_import_admission_list(&admission.imports) ) } @@ -6290,7 +6290,7 @@ pub fn emit_source_root_ingest_manifest( out.push_str(" ImportVisible,\n"); out.push_str(" ResolutionSubject\n"); out.push_str("}\n"); - out.push_str("import v2.std.qualified_name { QnCons, QnEmpty }\n"); + out.push_str("import v2.std.algebra { Cons, Empty }\n"); } out.push('\n'); out.push_str(&format!( @@ -9050,7 +9050,7 @@ pub fn shell_argv_nodes_for_operation( } pub fn qualified_name_resolves_in_derived_module_set(qn: &crate::v1_interpreter::Value) -> bool { - let module_path = qualified_name_value_to_module_path(qn); + let module_path = free_monoid_symbol_value_to_dotted_string(qn); !module_path.is_empty() && build_module_path_index_from_witness_roots().contains_key(&module_path) } diff --git a/src/v1/stage0/src/coproduct_reflection.rs b/src/v1/stage0/src/coproduct_reflection.rs index cee969b9245..9ad37f39b5d 100644 --- a/src/v1/stage0/src/coproduct_reflection.rs +++ b/src/v1/stage0/src/coproduct_reflection.rs @@ -355,7 +355,7 @@ pub fn eval_qualified_name_from_dotted_string( args.first().map(|(_, v)| v), "qualified_name_from_dotted_string", )?; - Ok(crate::cli_run::qualified_name_value_from_dotted_string( + Ok(crate::cli_run::free_monoid_symbol_value_from_dotted_string( ctx, &dotted, )) } diff --git a/src/v1/stage0/src/external_authority_project.rs b/src/v1/stage0/src/external_authority_project.rs index 025fb6351ee..0b5bc722f8e 100644 --- a/src/v1/stage0/src/external_authority_project.rs +++ b/src/v1/stage0/src/external_authority_project.rs @@ -126,14 +126,14 @@ pub fn external_authority_scheme_identity_for_module_path(module_path: String) - pub fn external_authority_anchor_kind_for_qualified_name( qn: &crate::v1_interpreter::Value, ) -> String { - let module_path = crate::cli_run::qualified_name_value_to_module_path(qn); + let module_path = crate::cli_run::free_monoid_symbol_value_to_dotted_string(qn); external_authority_anchor_kind_for_module_path(module_path) } pub fn external_authority_scheme_identity_for_qualified_name( qn: &crate::v1_interpreter::Value, ) -> String { - let module_path = crate::cli_run::qualified_name_value_to_module_path(qn); + let module_path = crate::cli_run::free_monoid_symbol_value_to_dotted_string(qn); external_authority_scheme_identity_for_module_path(module_path) } @@ -145,7 +145,7 @@ pub fn external_authority_locator_for_module_path(module_path: String) -> String } pub fn external_authority_locator_for_qualified_name(qn: &crate::v1_interpreter::Value) -> String { - let module_path = crate::cli_run::qualified_name_value_to_module_path(qn); + let module_path = crate::cli_run::free_monoid_symbol_value_to_dotted_string(qn); external_authority_locator_for_module_path(module_path) } @@ -164,7 +164,7 @@ pub fn qualified_name_value_from_module_path( ctx: &crate::v1_interpreter::InterpContext, module_path: &str, ) -> crate::v1_interpreter::Value { - crate::cli_run::qualified_name_value_from_dotted_string(ctx, module_path) + crate::cli_run::free_monoid_symbol_value_from_dotted_string(ctx, module_path) } pub fn derived_extdeps_modules_value( @@ -214,7 +214,7 @@ pub fn is_backfill_pending_for_module_path(module_path: &str) -> bool { } pub fn is_backfill_pending_for_qualified_name(qn: &crate::v1_interpreter::Value) -> bool { - let module_path = crate::cli_run::qualified_name_value_to_module_path(qn); + let module_path = crate::cli_run::free_monoid_symbol_value_to_dotted_string(qn); is_backfill_pending_for_module_path(&module_path) } @@ -236,7 +236,7 @@ pub fn is_machinery_exempt_for_module_path(module_path: &str) -> bool { } pub fn is_machinery_exempt_for_qualified_name(qn: &crate::v1_interpreter::Value) -> bool { - let module_path = crate::cli_run::qualified_name_value_to_module_path(qn); + let module_path = crate::cli_run::free_monoid_symbol_value_to_dotted_string(qn); is_machinery_exempt_for_module_path(&module_path) } @@ -251,7 +251,7 @@ pub fn is_clean_tree_roster_excluded_for_module_path(module_path: &str) -> bool } pub fn is_clean_tree_roster_excluded_for_qualified_name(qn: &crate::v1_interpreter::Value) -> bool { - let module_path = crate::cli_run::qualified_name_value_to_module_path(qn); + let module_path = crate::cli_run::free_monoid_symbol_value_to_dotted_string(qn); is_clean_tree_roster_excluded_for_module_path(&module_path) } @@ -350,7 +350,7 @@ pub fn external_authority_anchor_shadow_masked_for_module_path(module_path: Stri pub fn external_authority_anchor_shadow_masked_for_qualified_name( qn: &crate::v1_interpreter::Value, ) -> bool { - let module_path = crate::cli_run::qualified_name_value_to_module_path(qn); + let module_path = crate::cli_run::free_monoid_symbol_value_to_dotted_string(qn); external_authority_anchor_shadow_masked_for_module_path(module_path) } diff --git a/src/v1/stage0/src/v1_interpreter.rs b/src/v1/stage0/src/v1_interpreter.rs index e28f82db73a..312184799b5 100644 --- a/src/v1/stage0/src/v1_interpreter.rs +++ b/src/v1/stage0/src/v1_interpreter.rs @@ -129,7 +129,7 @@ fn resolve_sym(sym: Symbol) -> String { .unwrap_or_else(|| format!("#{}", sym.0)) } -pub fn qualified_name_value_to_module_path(value: &Value) -> String { +pub fn free_monoid_symbol_value_to_dotted_string(value: &Value) -> String { match value { Value::Variant { variant_name, @@ -137,10 +137,10 @@ pub fn qualified_name_value_to_module_path(value: &Value) -> String { .. } => { let variant = resolve_sym(*variant_name); - if variant == "QnEmpty" { + if variant == "Empty" { return String::new(); } - if variant == "QnCons" { + if variant == "Cons" { let head = fields .iter() .find(|(k, _)| resolve_sym(*k) == "head") @@ -166,26 +166,24 @@ pub fn qualified_name_value_to_module_path(value: &Value) -> String { } _ => None, }) - .unwrap_or_else(|| { - panic!("qualified_name_to_module_path: QnCons.head not Str") - }); + .unwrap_or_else(|| panic!("free_monoid_symbol_to_dotted: Cons.head not Str")); let tail = fields .iter() .find(|(k, _)| resolve_sym(*k) == "tail") .map(|(_, v)| v) - .expect("qualified_name_to_module_path: QnCons.tail missing"); - let rest = qualified_name_value_to_module_path(tail); + .expect("free_monoid_symbol_to_dotted: Cons.tail missing"); + let rest = free_monoid_symbol_value_to_dotted_string(tail); if rest.is_empty() { head } else { format!("{head}.{rest}") } } else { - panic!("qualified_name_to_module_path: unexpected variant '{variant}'"); + panic!("free_monoid_symbol_to_dotted: unexpected variant '{variant}'"); } } other => { - panic!("qualified_name_to_module_path: expected QualifiedName variant, got {other:?}") + panic!("free_monoid_symbol_to_dotted: expected FreeMonoid variant, got {other:?}") } } } @@ -5668,7 +5666,7 @@ fn eval_builtin( msg: "extdeps_shape_transport_policy_facts_for_qualified_name requires a QualifiedName" .to_string(), })?; - let module_path = crate::cli_run::qualified_name_value_to_module_path(qn); + let module_path = crate::cli_run::free_monoid_symbol_value_to_dotted_string(qn); let facts = crate::cli_run::extdeps_shape_transport_policy_module_facts(&module_path); let argv_items: Vec = facts .argv_facts diff --git a/src/v1/tests/src/source_root_ingest_manifest_host_test.rs b/src/v1/tests/src/source_root_ingest_manifest_host_test.rs index 5228305514c..215fce435f7 100644 --- a/src/v1/tests/src/source_root_ingest_manifest_host_test.rs +++ b/src/v1/tests/src/source_root_ingest_manifest_host_test.rs @@ -47,7 +47,7 @@ fn manifest_entry_admission_qualified_name_is_well_formed() { let manifest = fs::read_to_string(&manifest_path).expect("read manifest"); assert!( manifest.contains( - "QnCons { head: ^v2, tail: QnCons { head: ^compiler, tail: QnCons { head: ^compile, tail: QnEmpty } } }" + "Cons { head: ^v2, tail: Cons { head: ^compiler, tail: Cons { head: ^compile, tail: Empty } } }" ), "manifest admission subject QN malformed:\n{manifest}" ); diff --git a/src/v2/compiler/03_name_resolve.dag b/src/v2/compiler/03_name_resolve.dag index 3c5480d1aa6..db40804de7d 100644 --- a/src/v2/compiler/03_name_resolve.dag +++ b/src/v2/compiler/03_name_resolve.dag @@ -59,10 +59,7 @@ import v2.std.cross_tree.resolution { cross_tree_edge_decision, source_root_index_empty } -import v2.std.qualified_name { - QualifiedName, - qualified_name_eq -} +import v2.std.qualified_name { QualifiedName } type ImportVisibility = ImportVisible @@ -159,7 +156,7 @@ fn module_root_name_find_fold( xs: names, empty: acc, cons: fn(st, candidate) { - if qualified_name_eq(a: candidate, b: name) { + if candidate == name { match st { ModuleRootNameNotFound => ModuleRootNameFoundOnce ModuleRootNameFoundOnce => ModuleRootNameFoundDuplicate @@ -252,7 +249,7 @@ fn module_root_find( Rejected { diagnostics: d } Accepted { value: candidate, diagnostics: _ } => Accepted { - value: match qualified_name_eq(a: candidate, b: name) { + value: match candidate == name { true => match fold_state { NoPassingCandidate => OnePassingCandidate { candidate: root } diff --git a/src/v2/extdeps/languages/dag.dag b/src/v2/extdeps/languages/dag.dag index 229552676eb..ce8cc7f1e3d 100644 --- a/src/v2/extdeps/languages/dag.dag +++ b/src/v2/extdeps/languages/dag.dag @@ -138,13 +138,7 @@ import v2.std.diagnostic { outcome_rejected, port_locus } -import v2.std.qualified_name { - QnCons, - QnEmpty, - QualifiedName, - qualified_name_for_all, - qualified_name_from_node -} +import v2.std.qualified_name { QualifiedName, qualified_name_from_node } import v2.extdeps.languages.fidelity { DeclaredNormalized, FailClosed, @@ -6176,29 +6170,29 @@ fn parse_import_block_idents( fn qualified_name_append_segment(qn: QualifiedName, sym: Symbol) -> QualifiedName { match qn { - QnEmpty => QnCons { head: sym, tail: QnEmpty } - QnCons { head: h, tail: t } => - QnCons { head: h, tail: qualified_name_append_segment(qn: t, sym: sym) } + Empty => Cons { head: sym, tail: Empty } + Cons { head: h, tail: t } => + Cons { head: h, tail: qualified_name_append_segment(qn: t, sym: sym) } } } fn qualified_name_from_segment_list(segments: List, root: Node) -> Outcome { let qn = fold_list( xs: segments, - empty: QnEmpty, + empty: Empty, cons: fn(acc, sym) { qualified_name_append_segment(qn: acc, sym: sym) } ) match qn { - QnEmpty => + Empty => outcome_rejected(Diagnostic { reason: ^qualified_name_structure_invalid, at: node_locus(node: root), correction: Unavailable { reason: ExternalContractUnknown } }) - QnCons { head: _, tail: _ } => - if qualified_name_for_all(qn: qn, predicate: fn(sym) { sym != ^dag_token_ident }) { + Cons { head: _, tail: _ } => + if for_all(xs: qn, predicate: fn(sym) { sym != ^dag_token_ident }) { outcome_accepted(value: qn) } else { outcome_rejected(Diagnostic { @@ -6221,14 +6215,14 @@ fn qualified_name_from_emit_shaped_module_root(root: Node) -> Outcome Rejected { diagnostics: diags } Accepted { value: qn, diagnostics: _ } => match qn { - QnEmpty => + Empty => outcome_rejected(Diagnostic { reason: ^qualified_name_structure_invalid, at: node_locus(node: root), correction: Unavailable { reason: ExternalContractUnknown } }) - QnCons { head: _, tail: _ } => - if qualified_name_for_all(qn: qn, predicate: fn(sym) { sym != ^dag_token_ident }) { + Cons { head: _, tail: _ } => + if for_all(xs: qn, predicate: fn(sym) { sym != ^dag_token_ident }) { outcome_accepted(value: qn) } else { outcome_rejected(Diagnostic { diff --git a/src/v2/lens/enforcement/vocab.dag b/src/v2/lens/enforcement/vocab.dag index 8a4441e70b5..3d3e6f243bc 100644 --- a/src/v2/lens/enforcement/vocab.dag +++ b/src/v2/lens/enforcement/vocab.dag @@ -10,7 +10,7 @@ type SubjectRoster { entries: List } -data subject_roster_string_dissolution_trigger: String = "🟡 dissolve-on: SubjectRoster modeled as List (StandingIntent.required_subjects + desired_scope + CoverageReceipt.discovered_subjects), not List as enforcement-intent-design SS12 sketched — because std qualified_name_from_dotted_string is an infinite-recursion OOM stub (gunb-ai/gunbc#6169). DISSOLVES WHEN #6169 grounds that std fn: restore required_subjects to List and compare against the discovered set via qualified_name_eq." +data subject_roster_string_dissolution_trigger: String = "🟡 dissolve-on: SubjectRoster modeled as List (StandingIntent.required_subjects + desired_scope + CoverageReceipt.discovered_subjects), not List as enforcement-intent-design SS12 sketched — a residue of when std qualified_name_from_dotted_string was an infinite-recursion OOM stub (gunb-ai/gunbc#6169, since fixed). #6169 is now grounded and QualifiedName is FreeMonoid, so the blocker is cleared: DISSOLVES BY restoring required_subjects to List and comparing against the discovered set via structural ==." type EnforcementMode = Advisory | AuditOnly | Blocking diff --git a/src/v2/lens/extdeps_external_authority/module_refs.dag b/src/v2/lens/extdeps_external_authority/module_refs.dag index 73524e9f299..4c0af349e78 100644 --- a/src/v2/lens/extdeps_external_authority/module_refs.dag +++ b/src/v2/lens/extdeps_external_authority/module_refs.dag @@ -1,63 +1,64 @@ module v2.lens.extdeps_external_authority.module_refs +import v2.std.algebra { Cons, Empty } import v2.std.collection { List } -import v2.std.qualified_name { QnCons, QnEmpty, QualifiedName } +import v2.std.qualified_name { QualifiedName } -data extdeps_uri_module: QualifiedName = QnCons { +data extdeps_uri_module: QualifiedName = Cons { head: ^extdeps, - tail: QnCons { head: ^uri, tail: QnEmpty } + tail: Cons { head: ^uri, tail: Empty } } -data extdeps_external_authority_module: QualifiedName = QnCons { +data extdeps_external_authority_module: QualifiedName = Cons { head: ^extdeps, - tail: QnCons { head: ^external_authority, tail: QnEmpty } + tail: Cons { head: ^external_authority, tail: Empty } } -data extdeps_fixture_missing_anchor_module: QualifiedName = QnCons { +data extdeps_fixture_missing_anchor_module: QualifiedName = Cons { head: ^extdeps, - tail: QnCons { + tail: Cons { head: ^fixture, - tail: QnCons { head: ^external_authority_missing, tail: QnEmpty } + tail: Cons { head: ^external_authority_missing, tail: Empty } } } -data extdeps_fixture_bogus_scheme_module: QualifiedName = QnCons { +data extdeps_fixture_bogus_scheme_module: QualifiedName = Cons { head: ^extdeps, - tail: QnCons { + tail: Cons { head: ^fixture, - tail: QnCons { head: ^external_authority_bogus_scheme, tail: QnEmpty } + tail: Cons { head: ^external_authority_bogus_scheme, tail: Empty } } } -data extdeps_fixture_clean_https_module: QualifiedName = QnCons { +data extdeps_fixture_clean_https_module: QualifiedName = Cons { head: ^extdeps, - tail: QnCons { + tail: Cons { head: ^fixture, - tail: QnCons { head: ^external_authority_clean_https, tail: QnEmpty } + tail: Cons { head: ^external_authority_clean_https, tail: Empty } } } -data extdeps_fixture_clean_https_no_anchor_module: QualifiedName = QnCons { +data extdeps_fixture_clean_https_no_anchor_module: QualifiedName = Cons { head: ^extdeps, - tail: QnCons { + tail: Cons { head: ^fixture, - tail: QnCons { head: ^external_authority_clean_https_no_anchor, tail: QnEmpty } + tail: Cons { head: ^external_authority_clean_https_no_anchor, tail: Empty } } } -data extdeps_fixture_file_anchor_module: QualifiedName = QnCons { +data extdeps_fixture_file_anchor_module: QualifiedName = Cons { head: ^extdeps, - tail: QnCons { + tail: Cons { head: ^fixture, - tail: QnCons { head: ^external_authority_file_anchor, tail: QnEmpty } + tail: Cons { head: ^external_authority_file_anchor, tail: Empty } } } -data extdeps_fixture_shadow_masked_module: QualifiedName = QnCons { +data extdeps_fixture_shadow_masked_module: QualifiedName = Cons { head: ^test, - tail: QnCons { + tail: Cons { head: ^fixture, - tail: QnCons { head: ^external_authority_shadow_masked, tail: QnEmpty } + tail: Cons { head: ^external_authority_shadow_masked, tail: Empty } } } diff --git a/src/v2/lens/extdeps_shape_transport_policy.dag b/src/v2/lens/extdeps_shape_transport_policy.dag index 49193d33e35..3f8d72c6d00 100644 --- a/src/v2/lens/extdeps_shape_transport_policy.dag +++ b/src/v2/lens/extdeps_shape_transport_policy.dag @@ -10,7 +10,7 @@ import v2.std.algebra { } import v2.std.collection { List } import v2.std.logic { Bool } -import v2.std.qualified_name { QualifiedName, qualified_name_eq } +import v2.std.qualified_name { QualifiedName } import v2.std.text { String } type ExtdepsTransportKind @@ -180,7 +180,7 @@ fn extdeps_live_module_dead_param_count_for_operation( } fn argv_fact_matches_module(fact: ExtdepsTransportArgvFact, module: QualifiedName) -> Bool { - qualified_name_eq(a: fact.module, b: module) + fact.module == module } fn argv_fact_matches_operation( @@ -195,7 +195,7 @@ fn argv_fact_matches_operation( } fn fusion_fact_matches_module(fact: ExtdepsTransportFusionFact, module: QualifiedName) -> Bool { - qualified_name_eq(a: fact.module, b: module) + fact.module == module } fn input_fact_matches_operation( @@ -204,7 +204,7 @@ fn input_fact_matches_operation( service: String, operation: String ) -> Bool { - qualified_name_eq(a: fact.module, b: module) + fact.module == module && fact.service == service && fact.operation == operation } diff --git a/src/v2/lens/extdeps_shape_transport_policy/module_refs.dag b/src/v2/lens/extdeps_shape_transport_policy/module_refs.dag index 0de83328cf1..6e5085db9a2 100644 --- a/src/v2/lens/extdeps_shape_transport_policy/module_refs.dag +++ b/src/v2/lens/extdeps_shape_transport_policy/module_refs.dag @@ -1,74 +1,75 @@ module v2.lens.extdeps_shape_transport_policy.module_refs +import v2.std.algebra { Cons, Empty } -import v2.std.qualified_name { QnCons, QnEmpty, QualifiedName } +import v2.std.qualified_name { QualifiedName } -data extdeps_cargo_build_module: QualifiedName = QnCons { +data extdeps_cargo_build_module: QualifiedName = Cons { head: ^extdeps, - tail: QnCons { head: ^cargo_build, tail: QnEmpty } + tail: Cons { head: ^cargo_build, tail: Empty } } -data extdeps_git_module: QualifiedName = QnCons { +data extdeps_git_module: QualifiedName = Cons { head: ^extdeps, - tail: QnCons { head: ^git, tail: QnEmpty } + tail: Cons { head: ^git, tail: Empty } } -data extdeps_gcp_module: QualifiedName = QnCons { +data extdeps_gcp_module: QualifiedName = Cons { head: ^extdeps, - tail: QnCons { + tail: Cons { head: ^cloud, - tail: QnCons { head: ^gcp, tail: QnCons { head: ^gcp, tail: QnEmpty } } + tail: Cons { head: ^gcp, tail: Cons { head: ^gcp, tail: Empty } } } } -data extdeps_github_gists_module: QualifiedName = QnCons { +data extdeps_github_gists_module: QualifiedName = Cons { head: ^extdeps, - tail: QnCons { head: ^github, tail: QnCons { head: ^gists, tail: QnEmpty } } + tail: Cons { head: ^github, tail: Cons { head: ^gists, tail: Empty } } } -data extdeps_runtime_local_module: QualifiedName = QnCons { +data extdeps_runtime_local_module: QualifiedName = Cons { head: ^extdeps, - tail: QnCons { head: ^runtime, tail: QnCons { head: ^local, tail: QnEmpty } } + tail: Cons { head: ^runtime, tail: Cons { head: ^local, tail: Empty } } } -data bogus_extdeps_module: QualifiedName = QnCons { +data bogus_extdeps_module: QualifiedName = Cons { head: ^extdeps, - tail: QnCons { head: ^bogus_unknown_module_xyz, tail: QnEmpty } + tail: Cons { head: ^bogus_unknown_module_xyz, tail: Empty } } -data coverage_domain_equivalence_module: QualifiedName = QnCons { +data coverage_domain_equivalence_module: QualifiedName = Cons { head: ^v2, - tail: QnCons { + tail: Cons { head: ^test, - tail: QnCons { + tail: Cons { head: ^extdeps_shape_transport_policy, - tail: QnCons { head: ^coverage_domain_equivalence, tail: QnEmpty } + tail: Cons { head: ^coverage_domain_equivalence, tail: Empty } } } } -data module_source_nickname_literal_green_module: QualifiedName = QnCons { +data module_source_nickname_literal_green_module: QualifiedName = Cons { head: ^v2, - tail: QnCons { + tail: Cons { head: ^test, - tail: QnCons { + tail: Cons { head: ^extdeps_shape_transport_policy, - tail: QnCons { + tail: Cons { head: ^lens_unit, - tail: QnCons { head: ^module_source_nickname_literal_green, tail: QnEmpty } + tail: Cons { head: ^module_source_nickname_literal_green, tail: Empty } } } } } -data module_source_nickname_literal_local_red_module: QualifiedName = QnCons { +data module_source_nickname_literal_local_red_module: QualifiedName = Cons { head: ^v2, - tail: QnCons { + tail: Cons { head: ^test, - tail: QnCons { + tail: Cons { head: ^extdeps_shape_transport_policy, - tail: QnCons { + tail: Cons { head: ^lens_unit, - tail: QnCons { head: ^module_source_nickname_literal_local_red, tail: QnEmpty } + tail: Cons { head: ^module_source_nickname_literal_local_red, tail: Empty } } } } diff --git a/src/v2/lens/visibility.dag b/src/v2/lens/visibility.dag index b9ed74350ad..adc8e0d3185 100644 --- a/src/v2/lens/visibility.dag +++ b/src/v2/lens/visibility.dag @@ -4,7 +4,7 @@ import std.disposition { SingleAuthority } import v2.std.logic { Bool } import v2.std.algebra { length, list_snoc_item } -import v2.std.qualified_name { QualifiedName, qualified_name_eq } +import v2.std.qualified_name { QualifiedName } type ModuleVisibilityFact { module: QualifiedName @@ -23,7 +23,7 @@ fn module_is_public(facts: List, qn: QualifiedName) -> Boo fold(facts, init: false, f: fn(acc, fct) { if acc { true } else { - if qualified_name_eq(a: fct.module, b: qn) { fct.public } else { false } + if fct.module == qn { fct.public } else { false } } }) } diff --git a/src/v2/lens/visibility_test.dag b/src/v2/lens/visibility_test.dag index 90702e0c39b..f59f68d9d01 100644 --- a/src/v2/lens/visibility_test.dag +++ b/src/v2/lens/visibility_test.dag @@ -1,16 +1,17 @@ module v2.test.lens_visibility.visibility_test +import v2.std.algebra { Cons, Empty } import v2.std.logic { Bool } -import v2.std.qualified_name { QualifiedName, QnCons, QnEmpty } +import v2.std.qualified_name { QualifiedName } import v2.lens.visibility { ModuleVisibilityFact, VisibilityLeak, scan_visibility_leaks, visibility_leak_count, visibility_clean } -data mod_public_api: QualifiedName = QnCons { head: ^public_api, tail: QnEmpty } -data mod_private_impl: QualifiedName = QnCons { head: ^private_impl, tail: QnEmpty } -data mod_public_util: QualifiedName = QnCons { head: ^public_util, tail: QnEmpty } -data mod_unknown_dep: QualifiedName = QnCons { head: ^unknown_dep, tail: QnEmpty } +data mod_public_api: QualifiedName = Cons { head: ^public_api, tail: Empty } +data mod_private_impl: QualifiedName = Cons { head: ^private_impl, tail: Empty } +data mod_public_util: QualifiedName = Cons { head: ^public_util, tail: Empty } +data mod_unknown_dep: QualifiedName = Cons { head: ^unknown_dep, tail: Empty } data no_imports: List = [] diff --git a/src/v2/std/compilers/target_model.dag b/src/v2/std/compilers/target_model.dag index 78f0b8c0516..dcad80737be 100644 --- a/src/v2/std/compilers/target_model.dag +++ b/src/v2/std/compilers/target_model.dag @@ -1,24 +1,6 @@ module v2.std.compilers.target_model -import v2.std.algebra { - Cons, - Empty, - Equal, - Greater, - Less, - Ordering, - FreeMonoid, - fold_list, - fold_list_node, - is_empty, - list_snoc_item, - length, - list_append, - fold_list_right, - list_tail, - TailAbsent, - TailFound -} +import v2.std.algebra { Cons, Empty, Equal, FreeMonoid, Greater, Less, Ordering, TailAbsent, TailFound, fold_list, fold_list_node, fold_list_right, is_empty, length, list_append, list_snoc_item, list_tail } import v2.std.collection { Absent, List, @@ -117,12 +99,7 @@ import v2.std.node_query { node_labeled_child_edges, node_positional_child_targets } -import v2.std.qualified_name { - QnCons, - QnEmpty, - QualifiedName, - qualified_name_from_node -} +import v2.std.qualified_name { QualifiedName, qualified_name_from_node } import v2.std.logic { Bool } import v2.std.text { Char, String } import v2.std.host_transport { @@ -5356,8 +5333,8 @@ fn target_import_to_concrete_tokens( fn import_qualified_name_symbols(qn: QualifiedName) -> List { match qn { - QnEmpty => Empty - QnCons { head: h, tail: t } => + Empty => Empty + Cons { head: h, tail: t } => Cons { head: h, tail: import_qualified_name_symbols(qn: t) } } } diff --git a/src/v2/std/cross_tree/resolution.dag b/src/v2/std/cross_tree/resolution.dag index 3ec22cc2c93..33f7fd979c0 100644 --- a/src/v2/std/cross_tree/resolution.dag +++ b/src/v2/std/cross_tree/resolution.dag @@ -1,6 +1,6 @@ module v2.std.cross_tree.resolution -import v2.std.algebra { Cons, Empty, FreeMonoid, fold_list } +import v2.std.algebra { Cons, Empty, FreeMonoid, HeadAbsent, HeadFound, fold_list, list_head } import v2.std.cross_tree.import_model { CoFundamental, CrossTreeAdmitted, @@ -25,13 +25,7 @@ import v2.std.layer { LayerPrefixWorkflow } import v2.std.logic { Bool } -import v2.std.qualified_name { - QualifiedName, - QnCons, - QnEmpty, - qualified_name_eq, - qualified_name_from_dotted_string -} +import v2.std.qualified_name { QualifiedName, qualified_name_from_dotted_string } import v2.std.text { String } type SourceRootBinding { @@ -66,7 +60,7 @@ fn source_root_index_lookup( xs: index, empty: SourceRootAbsent, cons: fn(acc, binding) { - if qualified_name_eq(a: binding.module, b: module) { + if binding.module == module { match acc { SourceRootAbsent => SourceRootResolved { root: binding.root } SourceRootResolved { root: prev } => @@ -110,12 +104,12 @@ fn layer_prefix_from_dotted_qualified_name(qn: String) -> LayerPrefix { fn layer_prefix_from_qualified_name(qn: QualifiedName) -> LayerPrefix { match qn { - QnEmpty => LayerPrefixStd - QnCons { head: h, tail: t } => + Empty => LayerPrefixStd + Cons { head: h, tail: t } => if h == ^v2 { - match t { - QnEmpty => LayerPrefixStd - QnCons { head: h2, tail: _ } => + match list_head(xs: t) { + HeadAbsent => LayerPrefixStd + HeadFound { value: h2 } => if h2 == ^std { LayerPrefixStd } else if h2 == ^extdeps { diff --git a/src/v2/std/qualified_name.dag b/src/v2/std/qualified_name.dag index b47dc25011e..fe7da2494b5 100644 --- a/src/v2/std/qualified_name.dag +++ b/src/v2/std/qualified_name.dag @@ -11,38 +11,14 @@ import v2.std.diagnostic { outcome_accepted, outcome_rejected } -import v2.std.algebra { fold_list_right } +import v2.std.algebra { Cons, Empty, FreeMonoid, HeadAbsent, HeadFound, fold_list_right, list_head } import v2.std.collection { List } import v2.std.compilers.lexing { symbol_intern_lexeme } import v2.std.logic { Bool } import v2.std.node { Atom, Conj, Edge, Named, Node, NodeFold, Symbol, TypeNode, fold_node } import v2.std.text { String, string_is_empty } -type QualifiedName - = QnEmpty - | QnCons { head: Symbol, tail: QualifiedName } - -fn qualified_name_singleton(sym: Symbol) -> QualifiedName { - QnCons { head: sym, tail: QnEmpty } -} - -fn qualified_name_eq(a: QualifiedName, b: QualifiedName) -> Bool { - match a { - QnEmpty => match b { QnEmpty => true QnCons { head: _, tail: _ } => false } - QnCons { head: ha, tail: ta } => - match b { - QnEmpty => false - QnCons { head: hb, tail: tb } => ha == hb && qualified_name_eq(a: ta, b: tb) - } - } -} - -fn qualified_name_for_all(qn: QualifiedName, predicate: fn(Symbol) -> Bool) -> Bool { - match qn { - QnEmpty => true - QnCons { head: h, tail: t } => predicate(h) && qualified_name_for_all(qn: t, predicate: predicate) - } -} +type QualifiedName = FreeMonoid type QnFoldStatus = QnFoldInit @@ -55,7 +31,7 @@ fn qn_fold_init(n: Node) -> QnFoldStatus { match n.kind { TypeNode { connective: Conj } => if count(n.children) == 0 { - QnFoldDone { qn: QnEmpty } + QnFoldDone { qn: Empty } } else if count(n.children) == 2 { QnFoldInit } else { @@ -67,7 +43,7 @@ fn qn_fold_init(n: Node) -> QnFoldStatus { } TypeNode { connective: Atom { identity: sym } } => if count(n.children) == 0 { - QnFoldDone { qn: QnCons { head: sym, tail: QnEmpty } } + QnFoldDone { qn: Cons { head: sym, tail: Empty } } } else { QnFoldError { diag: Diagnostic { reason: ^qualified_name_structure_invalid, @@ -97,11 +73,19 @@ fn qn_fold_step(acc: QnFoldStatus, edge: Edge, child: QnFoldStatus) -> QnFoldSta match edge.target.kind { TypeNode { connective: Atom { identity: _ } } => match child_qn { - QnCons { head: sym, tail: QnEmpty } => - match acc { - QnFoldInit => QnFoldHeadSeen { sym: sym } - QnFoldTailSeen { tail: tail_qn } => QnFoldDone { qn: QnCons { head: sym, tail: tail_qn } } - _ => QnFoldError { diag: Diagnostic { + Cons { head: sym, tail: child_tail } => + match list_head(xs: child_tail) { + HeadAbsent => + match acc { + QnFoldInit => QnFoldHeadSeen { sym: sym } + QnFoldTailSeen { tail: tail_qn } => QnFoldDone { qn: Cons { head: sym, tail: tail_qn } } + _ => QnFoldError { diag: Diagnostic { + reason: ^qualified_name_structure_invalid, + at: node_locus(node: edge.target), + correction: Unavailable { reason: ExternalContractUnknown } + }} + } + HeadFound { value: _ } => QnFoldError { diag: Diagnostic { reason: ^qualified_name_structure_invalid, at: node_locus(node: edge.target), correction: Unavailable { reason: ExternalContractUnknown } @@ -124,7 +108,7 @@ fn qn_fold_step(acc: QnFoldStatus, edge: Edge, child: QnFoldStatus) -> QnFoldSta TypeNode { connective: Conj } => match acc { QnFoldInit => QnFoldTailSeen { tail: child_qn } - QnFoldHeadSeen { sym: sym } => QnFoldDone { qn: QnCons { head: sym, tail: child_qn } } + QnFoldHeadSeen { sym: sym } => QnFoldDone { qn: Cons { head: sym, tail: child_qn } } _ => QnFoldError { diag: Diagnostic { reason: ^qualified_name_structure_invalid, at: node_locus(node: edge.target), @@ -159,19 +143,19 @@ fn qn_fold_step(acc: QnFoldStatus, edge: Edge, child: QnFoldStatus) -> QnFoldSta } } -fn qualified_name_from_segment_list(segments: List) -> QualifiedName { +fn qualified_name_from_segment_list(segments: List) -> FreeMonoid { fold_list_right( xs: segments, - empty: QnEmpty, + empty: Empty, snoc: fn(tail, segment) { - QnCons { head: symbol_intern_lexeme(lexeme: segment), tail: tail } + Cons { head: symbol_intern_lexeme(lexeme: segment), tail: tail } } ) } -fn qualified_name_from_dotted_string(dotted: String) -> QualifiedName { +fn qualified_name_from_dotted_string(dotted: String) -> FreeMonoid { if string_is_empty(s: dotted) { - QnEmpty + Empty } else { qualified_name_from_segment_list(segments: dotted.split(delimiter: ".")) } diff --git a/src/v2/std/qualified_name/from_node.dag b/src/v2/std/qualified_name/from_node.dag index 8aec2db2ec0..830815c53a3 100644 --- a/src/v2/std/qualified_name/from_node.dag +++ b/src/v2/std/qualified_name/from_node.dag @@ -3,7 +3,7 @@ module v2.test.qualified_name.from_node import v2.std.algebra { Cons, Empty, fold_list_node } import v2.std.diagnostic { Accepted, Outcome, Rejected } import v2.std.node { Atom, Conj, Edge, Named, Node, Symbol, TypeNode, SyntheticOccurrence } -import v2.std.qualified_name { QnCons, QnEmpty, QualifiedName, qualified_name_eq, qualified_name_from_node } +import v2.std.qualified_name { QualifiedName, qualified_name_from_node } import v2.std.logic { Bool } import v2.std.verification { EqualsClaim, @@ -41,7 +41,7 @@ fn qn_outcome_accepted(out: Outcome) -> Bool { fn qn_value_eq(out: Outcome, expected: QualifiedName) -> Bool { match out { Rejected { diagnostics: _ } => false - Accepted { value: actual, diagnostics: _ } => qualified_name_eq(a: actual, b: expected) + Accepted { value: actual, diagnostics: _ } => actual == expected } } @@ -151,7 +151,7 @@ data claim_from_node_single_accepted: TestClaim = EqualsClaim { anchor: manual_claim_anchor(anchor: ManualAnchorAbsent), lhs: qn_bool_atom(b: qn_value_eq( out: qualified_name_from_node(root: qn_single_list_node), - expected: QnCons { head: ^qn_sym_a, tail: QnEmpty } + expected: Cons { head: ^qn_sym_a, tail: Empty } )), rhs: qn_bool_atom(b: true), classification: TestClassification { tier: Tier1, layer: Unit } @@ -162,7 +162,7 @@ data claim_from_node_multi_accepted: TestClaim = EqualsClaim { anchor: manual_claim_anchor(anchor: ManualAnchorAbsent), lhs: qn_bool_atom(b: qn_value_eq( out: qualified_name_from_node(root: qn_three_list_node), - expected: QnCons { head: ^qn_sym_a, tail: QnCons { head: ^qn_sym_b, tail: QnCons { head: ^qn_sym_c, tail: QnEmpty } } } + expected: Cons { head: ^qn_sym_a, tail: Cons { head: ^qn_sym_b, tail: Cons { head: ^qn_sym_c, tail: Empty } } } )), rhs: qn_bool_atom(b: true), classification: TestClassification { tier: Tier1, layer: Unit } @@ -205,7 +205,7 @@ data claim_from_node_reversed_order_accepted: TestClaim = EqualsClaim { anchor: manual_claim_anchor(anchor: ManualAnchorAbsent), lhs: qn_bool_atom(b: qn_value_eq( out: qualified_name_from_node(root: qn_single_reversed_node), - expected: QnCons { head: ^qn_sym_a, tail: QnEmpty } + expected: Cons { head: ^qn_sym_a, tail: Empty } )), rhs: qn_bool_atom(b: true), classification: TestClassification { tier: Tier1, layer: Unit } diff --git a/src/v2/test/claim/cross_tree_real_ingest_activation_test.dag b/src/v2/test/claim/cross_tree_real_ingest_activation_test.dag index 8adf2ff6606..fddfabc512b 100644 --- a/src/v2/test/claim/cross_tree_real_ingest_activation_test.dag +++ b/src/v2/test/claim/cross_tree_real_ingest_activation_test.dag @@ -24,7 +24,7 @@ import v2.std.cross_tree.resolution { cross_tree_edge_decision } import v2.std.logic { Bool } -import v2.std.qualified_name { QnCons, QnEmpty, QualifiedName } +import v2.std.qualified_name { QualifiedName } data ct_real_v2_subject_source: Medium = Medium { carried: "module v2.ct_real_subject\n", @@ -87,11 +87,11 @@ data ct_real_dag_to_v2_ingest: SourceRootIngest = Cons { } fn ct_real_subject_qn() -> QualifiedName { - QnCons { head: ^v2, tail: QnCons { head: ^ct_real_subject, tail: QnEmpty } } + Cons { head: ^v2, tail: Cons { head: ^ct_real_subject, tail: Empty } } } fn ct_real_target_qn() -> QualifiedName { - QnCons { head: ^ct_real_target, tail: QnEmpty } + Cons { head: ^ct_real_target, tail: Empty } } fn ct_real_edge_decision(ingest: SourceRootIngest) -> CrossTreeEdgeDecision { diff --git a/src/v2/test/claim/execution/typescript_import_emit_by_execution_test.dag b/src/v2/test/claim/execution/typescript_import_emit_by_execution_test.dag index 98a68e7c85f..ccce95cad8e 100644 --- a/src/v2/test/claim/execution/typescript_import_emit_by_execution_test.dag +++ b/src/v2/test/claim/execution/typescript_import_emit_by_execution_test.dag @@ -20,12 +20,7 @@ import v2.std.node { TypeNode } import v2.std.node_query { find_named_child, node_positional_child_targets } -import v2.std.qualified_name { - QnCons, - QnEmpty, - QualifiedName, - qualified_name_from_node -} +import v2.std.qualified_name { QualifiedName, qualified_name_from_node } import v2.std.compilers.target_model { TargetImport, TargetModel, @@ -144,8 +139,8 @@ fn ts_import_witness_target_model() -> TargetModel { fn ts_import_qualified_name_symbols(qn: QualifiedName) -> List { match qn { - QnEmpty => Empty - QnCons { head: h, tail: t } => + Empty => Empty + Cons { head: h, tail: t } => Cons { head: h, tail: ts_import_qualified_name_symbols(qn: t) } } } diff --git a/src/v2/test/claim/extdeps_external_authority/corpus/backfill_roster_soundness_test.dag b/src/v2/test/claim/extdeps_external_authority/corpus/backfill_roster_soundness_test.dag index 665553784cd..1434c4bc6eb 100644 --- a/src/v2/test/claim/extdeps_external_authority/corpus/backfill_roster_soundness_test.dag +++ b/src/v2/test/claim/extdeps_external_authority/corpus/backfill_roster_soundness_test.dag @@ -1,13 +1,13 @@ module v2.test.extdeps_external_authority.corpus.backfill_roster_soundness -import v2.std.algebra { any, for_all, list_append } +import v2.std.algebra { Cons, Empty, any, for_all, list_append } import v2.std.collection { List } import v2.std.logic { Bool } -import v2.std.qualified_name { QnCons, QnEmpty, QualifiedName } +import v2.std.qualified_name { QualifiedName } -data planted_stale_backfill_entry: QualifiedName = QnCons { +data planted_stale_backfill_entry: QualifiedName = Cons { head: ^extdeps, - tail: QnCons { head: ^nonexistent_planted_backfill_module, tail: QnEmpty } + tail: Cons { head: ^nonexistent_planted_backfill_module, tail: Empty } } fn qn_list_contains(xs: List, target: QualifiedName) -> Bool { diff --git a/src/v2/test/claim/extdeps_shape_transport_policy/coverage_domain_equivalence_module_refs.dag b/src/v2/test/claim/extdeps_shape_transport_policy/coverage_domain_equivalence_module_refs.dag index 602b92b8525..e9def097e45 100644 --- a/src/v2/test/claim/extdeps_shape_transport_policy/coverage_domain_equivalence_module_refs.dag +++ b/src/v2/test/claim/extdeps_shape_transport_policy/coverage_domain_equivalence_module_refs.dag @@ -1,45 +1,46 @@ module v2.test.extdeps_shape_transport_policy.coverage_domain_equivalence_module_refs +import v2.std.algebra { Cons, Empty } -import v2.std.qualified_name { QnCons, QnEmpty, QualifiedName } +import v2.std.qualified_name { QualifiedName } -data witness_policy_leak_cargo_build_lens_unit_module: QualifiedName = QnCons { head: ^v2, tail: QnCons { head: ^test, tail: QnCons { head: ^extdeps_shape_transport_policy, tail: QnCons { head: ^lens_unit, tail: QnCons { head: ^policy_leak_cargo_build, tail: QnEmpty } } } } } +data witness_policy_leak_cargo_build_lens_unit_module: QualifiedName = Cons { head: ^v2, tail: Cons { head: ^test, tail: Cons { head: ^extdeps_shape_transport_policy, tail: Cons { head: ^lens_unit, tail: Cons { head: ^policy_leak_cargo_build, tail: Empty } } } } } -data witness_policy_leak_cargo_build_corpus_module: QualifiedName = QnCons { head: ^v2, tail: QnCons { head: ^test, tail: QnCons { head: ^extdeps_shape_transport_policy, tail: QnCons { head: ^corpus, tail: QnCons { head: ^cargo_build_policy_leak, tail: QnEmpty } } } } } +data witness_policy_leak_cargo_build_corpus_module: QualifiedName = Cons { head: ^v2, tail: Cons { head: ^test, tail: Cons { head: ^extdeps_shape_transport_policy, tail: Cons { head: ^corpus, tail: Cons { head: ^cargo_build_policy_leak, tail: Empty } } } } } -data witness_policy_leak_cargo_fmt_lens_unit_module: QualifiedName = QnCons { head: ^v2, tail: QnCons { head: ^test, tail: QnCons { head: ^extdeps_shape_transport_policy, tail: QnCons { head: ^lens_unit, tail: QnCons { head: ^policy_leak_cargo_fmt, tail: QnEmpty } } } } } +data witness_policy_leak_cargo_fmt_lens_unit_module: QualifiedName = Cons { head: ^v2, tail: Cons { head: ^test, tail: Cons { head: ^extdeps_shape_transport_policy, tail: Cons { head: ^lens_unit, tail: Cons { head: ^policy_leak_cargo_fmt, tail: Empty } } } } } -data witness_policy_leak_cargo_doc_lens_unit_module: QualifiedName = QnCons { head: ^v2, tail: QnCons { head: ^test, tail: QnCons { head: ^extdeps_shape_transport_policy, tail: QnCons { head: ^lens_unit, tail: QnCons { head: ^policy_leak_cargo_doc, tail: QnEmpty } } } } } +data witness_policy_leak_cargo_doc_lens_unit_module: QualifiedName = Cons { head: ^v2, tail: Cons { head: ^test, tail: Cons { head: ^extdeps_shape_transport_policy, tail: Cons { head: ^lens_unit, tail: Cons { head: ^policy_leak_cargo_doc, tail: Empty } } } } } -data witness_policy_leak_cargo_fmt_corpus_module: QualifiedName = QnCons { head: ^v2, tail: QnCons { head: ^test, tail: QnCons { head: ^extdeps_shape_transport_policy, tail: QnCons { head: ^corpus, tail: QnCons { head: ^cargo_fmt_policy_leak, tail: QnEmpty } } } } } +data witness_policy_leak_cargo_fmt_corpus_module: QualifiedName = Cons { head: ^v2, tail: Cons { head: ^test, tail: Cons { head: ^extdeps_shape_transport_policy, tail: Cons { head: ^corpus, tail: Cons { head: ^cargo_fmt_policy_leak, tail: Empty } } } } } -data witness_policy_leak_cargo_doc_corpus_module: QualifiedName = QnCons { head: ^v2, tail: QnCons { head: ^test, tail: QnCons { head: ^extdeps_shape_transport_policy, tail: QnCons { head: ^corpus, tail: QnCons { head: ^cargo_doc_policy_leak, tail: QnEmpty } } } } } +data witness_policy_leak_cargo_doc_corpus_module: QualifiedName = Cons { head: ^v2, tail: Cons { head: ^test, tail: Cons { head: ^extdeps_shape_transport_policy, tail: Cons { head: ^corpus, tail: Cons { head: ^cargo_doc_policy_leak, tail: Empty } } } } } -data witness_git_policy_leak_corpus_module: QualifiedName = QnCons { head: ^v2, tail: QnCons { head: ^test, tail: QnCons { head: ^extdeps_shape_transport_policy, tail: QnCons { head: ^corpus, tail: QnCons { head: ^git_policy_leak, tail: QnEmpty } } } } } +data witness_git_policy_leak_corpus_module: QualifiedName = Cons { head: ^v2, tail: Cons { head: ^test, tail: Cons { head: ^extdeps_shape_transport_policy, tail: Cons { head: ^corpus, tail: Cons { head: ^git_policy_leak, tail: Empty } } } } } -data witness_clean_git_diff_lens_unit_module: QualifiedName = QnCons { head: ^v2, tail: QnCons { head: ^test, tail: QnCons { head: ^extdeps_shape_transport_policy, tail: QnCons { head: ^lens_unit, tail: QnCons { head: ^clean_git_diff, tail: QnEmpty } } } } } +data witness_clean_git_diff_lens_unit_module: QualifiedName = Cons { head: ^v2, tail: Cons { head: ^test, tail: Cons { head: ^extdeps_shape_transport_policy, tail: Cons { head: ^lens_unit, tail: Cons { head: ^clean_git_diff, tail: Empty } } } } } -data witness_clean_gist_create_lens_unit_module: QualifiedName = QnCons { head: ^v2, tail: QnCons { head: ^test, tail: QnCons { head: ^extdeps_shape_transport_policy, tail: QnCons { head: ^lens_unit, tail: QnCons { head: ^clean_gist_create, tail: QnEmpty } } } } } +data witness_clean_gist_create_lens_unit_module: QualifiedName = Cons { head: ^v2, tail: Cons { head: ^test, tail: Cons { head: ^extdeps_shape_transport_policy, tail: Cons { head: ^lens_unit, tail: Cons { head: ^clean_gist_create, tail: Empty } } } } } -data witness_gist_create_corpus_module: QualifiedName = QnCons { head: ^v2, tail: QnCons { head: ^test, tail: QnCons { head: ^extdeps_shape_transport_policy, tail: QnCons { head: ^corpus, tail: QnCons { head: ^gist_create_policy_leak, tail: QnEmpty } } } } } +data witness_gist_create_corpus_module: QualifiedName = Cons { head: ^v2, tail: Cons { head: ^test, tail: Cons { head: ^extdeps_shape_transport_policy, tail: Cons { head: ^corpus, tail: Cons { head: ^gist_create_policy_leak, tail: Empty } } } } } -data witness_transport_fusion_gcp_oauth_lens_unit_module: QualifiedName = QnCons { head: ^v2, tail: QnCons { head: ^test, tail: QnCons { head: ^extdeps_shape_transport_policy, tail: QnCons { head: ^lens_unit, tail: QnCons { head: ^transport_fusion_gcp_oauth, tail: QnEmpty } } } } } +data witness_transport_fusion_gcp_oauth_lens_unit_module: QualifiedName = Cons { head: ^v2, tail: Cons { head: ^test, tail: Cons { head: ^extdeps_shape_transport_policy, tail: Cons { head: ^lens_unit, tail: Cons { head: ^transport_fusion_gcp_oauth, tail: Empty } } } } } -data witness_transport_fusion_gcp_oauth_corpus_module: QualifiedName = QnCons { head: ^v2, tail: QnCons { head: ^test, tail: QnCons { head: ^extdeps_shape_transport_policy, tail: QnCons { head: ^corpus, tail: QnCons { head: ^gcp_oauth_fusion_fork, tail: QnEmpty } } } } } +data witness_transport_fusion_gcp_oauth_corpus_module: QualifiedName = Cons { head: ^v2, tail: Cons { head: ^test, tail: Cons { head: ^extdeps_shape_transport_policy, tail: Cons { head: ^corpus, tail: Cons { head: ^gcp_oauth_fusion_fork, tail: Empty } } } } } -data witness_dead_param_cargo_build_lens_unit_module: QualifiedName = QnCons { head: ^v2, tail: QnCons { head: ^test, tail: QnCons { head: ^extdeps_shape_transport_policy, tail: QnCons { head: ^lens_unit, tail: QnCons { head: ^dead_param_cargo_build, tail: QnEmpty } } } } } +data witness_dead_param_cargo_build_lens_unit_module: QualifiedName = Cons { head: ^v2, tail: Cons { head: ^test, tail: Cons { head: ^extdeps_shape_transport_policy, tail: Cons { head: ^lens_unit, tail: Cons { head: ^dead_param_cargo_build, tail: Empty } } } } } -data witness_dead_param_gcp_login_lens_unit_module: QualifiedName = QnCons { head: ^v2, tail: QnCons { head: ^test, tail: QnCons { head: ^extdeps_shape_transport_policy, tail: QnCons { head: ^lens_unit, tail: QnCons { head: ^dead_param_gcp_login, tail: QnEmpty } } } } } +data witness_dead_param_gcp_login_lens_unit_module: QualifiedName = Cons { head: ^v2, tail: Cons { head: ^test, tail: Cons { head: ^extdeps_shape_transport_policy, tail: Cons { head: ^lens_unit, tail: Cons { head: ^dead_param_gcp_login, tail: Empty } } } } } -data witness_dead_param_cargo_clippy_lens_unit_module: QualifiedName = QnCons { head: ^v2, tail: QnCons { head: ^test, tail: QnCons { head: ^extdeps_shape_transport_policy, tail: QnCons { head: ^lens_unit, tail: QnCons { head: ^dead_param_cargo_clippy, tail: QnEmpty } } } } } +data witness_dead_param_cargo_clippy_lens_unit_module: QualifiedName = Cons { head: ^v2, tail: Cons { head: ^test, tail: Cons { head: ^extdeps_shape_transport_policy, tail: Cons { head: ^lens_unit, tail: Cons { head: ^dead_param_cargo_clippy, tail: Empty } } } } } -data witness_dead_param_cargo_clippy_corpus_module: QualifiedName = QnCons { head: ^v2, tail: QnCons { head: ^test, tail: QnCons { head: ^extdeps_shape_transport_policy, tail: QnCons { head: ^corpus, tail: QnCons { head: ^cargo_clippy_dead_param, tail: QnEmpty } } } } } +data witness_dead_param_cargo_clippy_corpus_module: QualifiedName = Cons { head: ^v2, tail: Cons { head: ^test, tail: Cons { head: ^extdeps_shape_transport_policy, tail: Cons { head: ^corpus, tail: Cons { head: ^cargo_clippy_dead_param, tail: Empty } } } } } -data witness_dead_param_cargo_fmt_corpus_module: QualifiedName = QnCons { head: ^v2, tail: QnCons { head: ^test, tail: QnCons { head: ^extdeps_shape_transport_policy, tail: QnCons { head: ^corpus, tail: QnCons { head: ^cargo_fmt_dead_param, tail: QnEmpty } } } } } +data witness_dead_param_cargo_fmt_corpus_module: QualifiedName = Cons { head: ^v2, tail: Cons { head: ^test, tail: Cons { head: ^extdeps_shape_transport_policy, tail: Cons { head: ^corpus, tail: Cons { head: ^cargo_fmt_dead_param, tail: Empty } } } } } -data witness_dead_param_cargo_doc_corpus_module: QualifiedName = QnCons { head: ^v2, tail: QnCons { head: ^test, tail: QnCons { head: ^extdeps_shape_transport_policy, tail: QnCons { head: ^corpus, tail: QnCons { head: ^cargo_doc_dead_param, tail: QnEmpty } } } } } +data witness_dead_param_cargo_doc_corpus_module: QualifiedName = Cons { head: ^v2, tail: Cons { head: ^test, tail: Cons { head: ^extdeps_shape_transport_policy, tail: Cons { head: ^corpus, tail: Cons { head: ^cargo_doc_dead_param, tail: Empty } } } } } -data witness_dead_param_gcp_login_corpus_module: QualifiedName = QnCons { head: ^v2, tail: QnCons { head: ^test, tail: QnCons { head: ^extdeps_shape_transport_policy, tail: QnCons { head: ^corpus, tail: QnCons { head: ^gcp_login_dead_param, tail: QnEmpty } } } } } +data witness_dead_param_gcp_login_corpus_module: QualifiedName = Cons { head: ^v2, tail: Cons { head: ^test, tail: Cons { head: ^extdeps_shape_transport_policy, tail: Cons { head: ^corpus, tail: Cons { head: ^gcp_login_dead_param, tail: Empty } } } } } -data witness_embedded_policy_lens_unit_module: QualifiedName = QnCons { head: ^v2, tail: QnCons { head: ^test, tail: QnCons { head: ^extdeps_shape_transport_policy, tail: QnCons { head: ^lens_unit, tail: QnCons { head: ^embedded_policy_literal_local, tail: QnEmpty } } } } } +data witness_embedded_policy_lens_unit_module: QualifiedName = Cons { head: ^v2, tail: Cons { head: ^test, tail: Cons { head: ^extdeps_shape_transport_policy, tail: Cons { head: ^lens_unit, tail: Cons { head: ^embedded_policy_literal_local, tail: Empty } } } } } -data witness_embedded_policy_corpus_module: QualifiedName = QnCons { head: ^v2, tail: QnCons { head: ^test, tail: QnCons { head: ^extdeps_shape_transport_policy, tail: QnCons { head: ^corpus, tail: QnCons { head: ^runtime_local_embedded_policy, tail: QnEmpty } } } } } +data witness_embedded_policy_corpus_module: QualifiedName = Cons { head: ^v2, tail: Cons { head: ^test, tail: Cons { head: ^extdeps_shape_transport_policy, tail: Cons { head: ^corpus, tail: Cons { head: ^runtime_local_embedded_policy, tail: Empty } } } } } diff --git a/src/v2/test/claim/manual/program_assembly_multi_file_test.dag b/src/v2/test/claim/manual/program_assembly_multi_file_test.dag index 20d7668822f..162f2fa3d89 100644 --- a/src/v2/test/claim/manual/program_assembly_multi_file_test.dag +++ b/src/v2/test/claim/manual/program_assembly_multi_file_test.dag @@ -35,7 +35,6 @@ import v2.std.node { SyntheticOccurrence, TypeNode } -import v2.std.qualified_name { QnCons, QnEmpty } fn pa_qn_node(seg: Symbol) -> Node { fold_list_node( @@ -135,11 +134,11 @@ fn pa_duplicate_module_roots() -> FreeMonoid { fn pa_cross_file_admission() -> Admission { Admission { subject: ResolutionSubject { - name: QnCons { head: ^pa_subject_seg, tail: QnEmpty } + name: Cons { head: ^pa_subject_seg, tail: Empty } }, imports: Cons { head: Import { - target: QnCons { head: ^pa_imported_seg, tail: QnEmpty }, + target: Cons { head: ^pa_imported_seg, tail: Empty }, visibility: ImportVisible }, tail: Empty @@ -206,7 +205,7 @@ test fn program_assembly_ingest_non_source_file_rejects() -> Bool { ingest: pa_ingest_non_source_ingest, admission: Admission { subject: ResolutionSubject { - name: QnCons { head: ^pa_subject_seg, tail: QnEmpty } + name: Cons { head: ^pa_subject_seg, tail: Empty } }, imports: Empty }, diff --git a/src/v2/test/claim/manual/resolve_compile_anchor.dag b/src/v2/test/claim/manual/resolve_compile_anchor.dag index 5d0b1c80a0e..6d4ee21bcac 100644 --- a/src/v2/test/claim/manual/resolve_compile_anchor.dag +++ b/src/v2/test/claim/manual/resolve_compile_anchor.dag @@ -30,7 +30,7 @@ import v2.std.node { TypeNode, SyntheticOccurrence } -import v2.std.qualified_name { QnCons, QnEmpty, QualifiedName } +import v2.std.qualified_name { QualifiedName } import v2.std.verification { CompilesClaim, ManualAnchorAbsent, @@ -264,7 +264,7 @@ fn resolve_subject_module_root_with_import_use() -> Node { } fn resolve_subject_name() -> QualifiedName { - QnCons { head: ^anchor_subject_path_segment, tail: QnEmpty } + Cons { head: ^anchor_subject_path_segment, tail: Empty } } fn resolve_roots_single_import() -> FreeMonoid { @@ -286,7 +286,7 @@ fn resolve_imported_use_tree() -> Node { } fn resolve_import_target() -> QualifiedName { - QnCons { head: ^anchor_imported_path_segment, tail: QnEmpty } + Cons { head: ^anchor_imported_path_segment, tail: Empty } } fn resolve_with_admission_imported_binding_accepts() -> Bool { diff --git a/src/v2/test/claim/name_resolve/admission_fail_closed.dag b/src/v2/test/claim/name_resolve/admission_fail_closed.dag index 75ce3410ebd..840da6051b8 100644 --- a/src/v2/test/claim/name_resolve/admission_fail_closed.dag +++ b/src/v2/test/claim/name_resolve/admission_fail_closed.dag @@ -23,7 +23,7 @@ import v2.std.collection { empty_map } import v2.std.diagnostic { Accepted, None, Outcome, Rejected, diagnostics_eq } import v2.std.logic { Bool } import v2.std.node { Atom, Conj, Edge, Named, Node, Positional, Symbol, TypeNode, SyntheticOccurrence } -import v2.std.qualified_name { QnCons, QnEmpty, QualifiedName } +import v2.std.qualified_name { QualifiedName } import v2.std.verification { CompilesClaim, ManualAnchorAbsent, @@ -90,7 +90,7 @@ fn fc_module_root(seg: Symbol) -> Node { } fn fc_qn(seg: Symbol) -> QualifiedName { - QnCons { head: seg, tail: QnEmpty } + Cons { head: seg, tail: Empty } } fn fc_duplicate_roots() -> FreeMonoid { diff --git a/src/v2/test/claim/name_resolve/malformed_imported_root.dag b/src/v2/test/claim/name_resolve/malformed_imported_root.dag index 6a1955791dc..40cb5ab42f5 100644 --- a/src/v2/test/claim/name_resolve/malformed_imported_root.dag +++ b/src/v2/test/claim/name_resolve/malformed_imported_root.dag @@ -16,7 +16,7 @@ import v2.extdeps.languages.dag { import v2.std.algebra { Cons, Empty, FreeMonoid, fold_list_node } import v2.std.collection { empty_map } import v2.std.node { Atom, Conj, Edge, Node, Positional, Symbol, TypeNode, SyntheticOccurrence } -import v2.std.qualified_name { QnCons, QnEmpty, QualifiedName } +import v2.std.qualified_name { QualifiedName } import v2.std.verification { CompilesClaim, ManualAnchorAbsent, @@ -77,7 +77,7 @@ fn malformed_root_node() -> Node { } fn malformed_entry_name() -> QualifiedName { - QnCons { head: ^malformed_seg, tail: QnEmpty } + Cons { head: ^malformed_seg, tail: Empty } } fn roots_with_malformed_entry() -> FreeMonoid { diff --git a/src/v2/test/claim/name_resolve_cross_tree_resolution_test.dag b/src/v2/test/claim/name_resolve_cross_tree_resolution_test.dag index 890908e8bf0..9b3fdd07ea3 100644 --- a/src/v2/test/claim/name_resolve_cross_tree_resolution_test.dag +++ b/src/v2/test/claim/name_resolve_cross_tree_resolution_test.dag @@ -32,7 +32,7 @@ import v2.std.node { SyntheticOccurrence, TypeNode } -import v2.std.qualified_name { QnCons, QnEmpty, QualifiedName } +import v2.std.qualified_name { QualifiedName } fn ct_qn_node(seg: Symbol) -> Node { fold_list_node( @@ -115,20 +115,20 @@ fn ct_subject_with_import_use( } fn ct_qn_one(seg: Symbol) -> QualifiedName { - QnCons { head: seg, tail: QnEmpty } + Cons { head: seg, tail: Empty } } fn ct_qn_v2(seg_b: Symbol) -> QualifiedName { - QnCons { + Cons { head: ^v2, - tail: QnCons { head: seg_b, tail: QnEmpty } + tail: Cons { head: seg_b, tail: Empty } } } fn ct_qn_v2_std() -> QualifiedName { - QnCons { + Cons { head: ^v2, - tail: QnCons { head: ^std, tail: QnEmpty } + tail: Cons { head: ^std, tail: Empty } } } diff --git a/src/v2/test/claim/parse/parse_binding_fidelity_test.dag b/src/v2/test/claim/parse/parse_binding_fidelity_test.dag index ad50cec334e..5a198d7c212 100644 --- a/src/v2/test/claim/parse/parse_binding_fidelity_test.dag +++ b/src/v2/test/claim/parse/parse_binding_fidelity_test.dag @@ -46,7 +46,7 @@ import v2.std.node { TypeNode, SyntheticOccurrence } -import v2.std.qualified_name { QnCons, QnEmpty, QualifiedName } +import v2.std.qualified_name { QualifiedName } fn pbf_parse_root() -> GrammarRoot { GrammarRoot { @@ -267,11 +267,11 @@ fn pbf_cross_file_import_resolves() -> Bool { roots: pbf_cross_file_roots(), admission: Admission { subject: ResolutionSubject { - name: QnCons { head: ^pbf_subject_seg, tail: QnEmpty } + name: Cons { head: ^pbf_subject_seg, tail: Empty } }, imports: Cons { head: Import { - target: QnCons { head: ^pbf_imported_seg, tail: QnEmpty }, + target: Cons { head: ^pbf_imported_seg, tail: Empty }, visibility: ImportVisible }, tail: Empty @@ -362,16 +362,16 @@ fn pbf_ambiguous_export_rejects() -> Bool { roots: pbf_ambiguous_import_roots(), admission: Admission { subject: ResolutionSubject { - name: QnCons { head: ^pbf_subject_seg, tail: QnEmpty } + name: Cons { head: ^pbf_subject_seg, tail: Empty } }, imports: Cons { head: Import { - target: QnCons { head: ^pbf_ambiguous_import_a_seg, tail: QnEmpty }, + target: Cons { head: ^pbf_ambiguous_import_a_seg, tail: Empty }, visibility: ImportVisible }, tail: Cons { head: Import { - target: QnCons { head: ^pbf_ambiguous_import_b_seg, tail: QnEmpty }, + target: Cons { head: ^pbf_ambiguous_import_b_seg, tail: Empty }, visibility: ImportVisible }, tail: Empty diff --git a/src/v2/test/claim/qualified_name/freemonoid_eq_witness_test.dag b/src/v2/test/claim/qualified_name/freemonoid_eq_witness_test.dag new file mode 100644 index 00000000000..905502a5c35 --- /dev/null +++ b/src/v2/test/claim/qualified_name/freemonoid_eq_witness_test.dag @@ -0,0 +1,36 @@ +module v2.test.claim.qualified_name.freemonoid_eq_witness + +import v2.std.algebra { Cons, Empty, FreeMonoid } +import v2.std.node { Symbol } +import v2.std.logic { Bool } + +type QnPath = FreeMonoid + +fn ab() -> QnPath { + Cons { head: ^a, tail: Cons { head: ^b, tail: Empty } } +} + +fn ab2() -> QnPath { + Cons { head: ^a, tail: Cons { head: ^b, tail: Empty } } +} + +fn ac() -> QnPath { + Cons { head: ^a, tail: Cons { head: ^c, tail: Empty } } +} + +fn a_only() -> QnPath { + Cons { head: ^a, tail: Empty } +} + +fn empty_path() -> QnPath { + Empty +} + +test fn freemonoid_structural_eq_matches_qn_eq() -> Bool { + ab() == ab2() + && !(ab() == ac()) + && !(ab() == a_only()) + && !(a_only() == empty_path()) + && empty_path() == empty_path() + && !(ab() == empty_path()) +} diff --git a/src/v2/test/claim/qualified_name/from_dotted_string_test.dag b/src/v2/test/claim/qualified_name/from_dotted_string_test.dag index 32122fe4c34..1f448f6f7b5 100644 --- a/src/v2/test/claim/qualified_name/from_dotted_string_test.dag +++ b/src/v2/test/claim/qualified_name/from_dotted_string_test.dag @@ -1,37 +1,24 @@ module v2.test.claim.qualified_name.from_dotted_string +import v2.std.algebra { Cons, Empty } import v2.std.cross_tree.resolution { layer_prefix_from_dotted_qualified_name } import v2.std.layer { LayerPrefixStd } import v2.std.logic { Bool } -import v2.std.qualified_name { - QnCons, - QnEmpty, - qualified_name_eq, - qualified_name_from_dotted_string -} +import v2.std.qualified_name { qualified_name_from_dotted_string } test fn qualified_name_from_dotted_string_empty_holds() -> Bool { - qualified_name_eq( - a: qualified_name_from_dotted_string(dotted: ""), - b: QnEmpty - ) + qualified_name_from_dotted_string(dotted: "") == Empty } test fn qualified_name_from_dotted_string_singleton_holds() -> Bool { - qualified_name_eq( - a: qualified_name_from_dotted_string(dotted: "std"), - b: QnCons { head: ^std, tail: QnEmpty } - ) + qualified_name_from_dotted_string(dotted: "std") == Cons { head: ^std, tail: Empty } } test fn qualified_name_from_dotted_string_multi_segment_holds() -> Bool { - qualified_name_eq( - a: qualified_name_from_dotted_string(dotted: "v2.std.text"), - b: QnCons { - head: ^v2, - tail: QnCons { head: ^std, tail: QnCons { head: ^text, tail: QnEmpty } } - } - ) + qualified_name_from_dotted_string(dotted: "v2.std.text") == Cons { + head: ^v2, + tail: Cons { head: ^std, tail: Cons { head: ^text, tail: Empty } } + } } test fn qualified_name_from_dotted_string_layer_prefix_holds() -> Bool { diff --git a/src/v2/test/claim/qualified_name/from_module_node.dag b/src/v2/test/claim/qualified_name/from_module_node.dag index 7ecc08ceca5..daa31b7cdc5 100644 --- a/src/v2/test/claim/qualified_name/from_module_node.dag +++ b/src/v2/test/claim/qualified_name/from_module_node.dag @@ -7,7 +7,7 @@ import v2.extdeps.languages.dag { import v2.std.algebra { Cons, Empty, fold_list_node } import v2.std.diagnostic { Accepted, Outcome, Rejected } import v2.std.node { Atom, Conj, Node, Symbol, TypeNode, SyntheticOccurrence } -import v2.std.qualified_name { QnCons, QnEmpty, QualifiedName, qualified_name_eq } +import v2.std.qualified_name { QualifiedName } import v2.std.logic { Bool } import v2.std.verification { EqualsClaim, @@ -45,7 +45,7 @@ fn fmn_outcome_accepted(out: Outcome) -> Bool { fn fmn_value_eq(out: Outcome, expected: QualifiedName) -> Bool { match out { Rejected { diagnostics: _ } => false - Accepted { value: actual, diagnostics: _ } => qualified_name_eq(a: actual, b: expected) + Accepted { value: actual, diagnostics: _ } => actual == expected } } @@ -77,7 +77,7 @@ data claim_from_module_node_accepted: TestClaim = EqualsClaim { anchor: manual_claim_anchor(anchor: ManualAnchorAbsent), lhs: fmn_bool_atom(b: fmn_value_eq( out: qualified_name_from_module_node(root: fmn_module_header_node), - expected: QnCons { head: ^fmn_sym_a, tail: QnCons { head: ^fmn_sym_b, tail: QnEmpty } } + expected: Cons { head: ^fmn_sym_a, tail: Cons { head: ^fmn_sym_b, tail: Empty } } )), rhs: fmn_bool_atom(b: true), classification: TestClassification { tier: Tier1, layer: Unit } diff --git a/src/v2/test/claim/workflow/host_source_root_ingest_manifest.dag b/src/v2/test/claim/workflow/host_source_root_ingest_manifest.dag index f3fc79c5e26..0b7005dabdb 100644 --- a/src/v2/test/claim/workflow/host_source_root_ingest_manifest.dag +++ b/src/v2/test/claim/workflow/host_source_root_ingest_manifest.dag @@ -8,8 +8,8 @@ import v2.compiler.source_authority { SourceRootIngest, SourceRootProvenanceCoverageReceipt, } -import v2.std.algebra { Empty } -import v2.std.qualified_name { QnCons, QnEmpty } +import v2.std.algebra { Cons, Empty } + import v2.std.text { String } data host_source_root_ingest_content_hash: String = "" @@ -24,9 +24,9 @@ data host_source_root_ingest: SourceRootIngest = Empty data host_compiler_closure_admission: Admission = Admission { subject: ResolutionSubject { - name: QnCons { + name: Cons { head: ^v2, - tail: QnCons { head: ^compiler, tail: QnCons { head: ^compile, tail: QnEmpty } } + tail: Cons { head: ^compiler, tail: Cons { head: ^compile, tail: Empty } } } }, imports: Empty