Skip to content
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -98,15 +98,20 @@ test fn w_host_arithmetic_on_peano_operands_refuses_in_the_bytes() -> Bool {
)
}

// THE BOOL ROW ON THE EMITTED PATH: a kernel true at a v2.std.logic.Bool boundary emits the
// structural constructor. (The interpreter realizes Bool natively and never executes this image;
// the emitted bytes are the only place the image exists, so this row is its whole evidence.)
test fn w_kernel_bool_at_structural_bool_boundary_emits_its_constructor() -> Bool {
// THE BOOL ROW ON THE EMITTED PATH, re-pinned under the uniform kernel precedence
// (direct_import_export_precedence_note, kernel installation independent of import cardinality):
// a bare direct import of the kernel spelling `Bool` cannot displace kernel identity, so a kernel
// true at this boundary emits the host keyword. The pre-precedence expectation (structural
// constructor) held only by ancestry occupancy -- a single-import module skipped the kernel
// overlay, so v2.std.logic.Bool won by leak, not by rule. The structural Bool image becomes
// reachable again when namespace Rule-1 dissolves the union leak; until then this row is the
// discriminating red that fires if leak-dependent resolution is reintroduced.
test fn w_kernel_bool_at_structural_bool_spelling_boundary_stays_the_keyword() -> Bool {
compile_dag_rust_emit_check(
"module test.claim.structural_bool_probe\nimport v2.std.logic { Bool }\nfn probe() -> Bool { true }\nfn probe_false(b: Bool) -> Bool { false }\n",
"src/test_claim_structural_bool_probe.rs",
["Bool::True", "Bool::False"],
["{\n true\n}", "{\n false\n}"]
["{\n true\n}", "{\n false\n}"],
["Bool::True", "Bool::False"]
)
}

Expand Down
71 changes: 48 additions & 23 deletions src/v1/04_infer.dag

Large diffs are not rendered by default.

39 changes: 15 additions & 24 deletions src/v1/stage0/src/extdeps_languages_rust_emit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,9 @@ pub fn rust_method_wraps_result() -> Rc<HashMap<String, bool>> {
})
.iter()
.cloned()
.fold(
v1_rt::rc_empty_map::<String, bool>(),
|acc: Rc<HashMap<String, bool>>, spec: _| {
v1_rt::rc_map_insert(acc, spec.method_name.clone(), true)
},
)
.fold(v1_rt::rc_empty_map::<String, bool>(), |acc: _, spec: _| {
v1_rt::rc_map_insert(acc, spec.method_name.clone(), true)
})
}

pub fn rust_reserved() -> Rc<Vec<String>> {
Expand Down Expand Up @@ -532,12 +529,12 @@ pub fn rt_function_registry() -> Rc<Vec<Rc<RuntimeFunction>>> {
}

pub fn rt_functions() -> Rc<HashMap<String, bool>> {
rt_function_registry().iter().cloned().fold(
v1_rt::rc_empty_map::<String, bool>(),
|acc: Rc<HashMap<String, bool>>, entry: Rc<RuntimeFunction>| {
rt_function_registry()
.iter()
.cloned()
.fold(v1_rt::rc_empty_map::<String, bool>(), |acc: _, entry: _| {
v1_rt::rc_map_insert(acc, entry.name.clone(), true)
},
)
})
}

pub fn rt_ref_map_functions() -> Rc<HashMap<String, bool>> {
Expand All @@ -552,12 +549,9 @@ pub fn rt_ref_map_functions() -> Rc<HashMap<String, bool>> {
})
.iter()
.cloned()
.fold(
v1_rt::rc_empty_map::<String, bool>(),
|acc: Rc<HashMap<String, bool>>, entry: Rc<RuntimeFunction>| {
v1_rt::rc_map_insert(acc, entry.name.clone(), true)
},
)
.fold(v1_rt::rc_empty_map::<String, bool>(), |acc: _, entry: _| {
v1_rt::rc_map_insert(acc, entry.name.clone(), true)
})
}

pub fn rt_wraps_result() -> Rc<HashMap<String, bool>> {
Expand All @@ -572,12 +566,9 @@ pub fn rt_wraps_result() -> Rc<HashMap<String, bool>> {
})
.iter()
.cloned()
.fold(
v1_rt::rc_empty_map::<String, bool>(),
|acc: Rc<HashMap<String, bool>>, entry: Rc<RuntimeFunction>| {
v1_rt::rc_map_insert(acc, entry.name.clone(), true)
},
)
.fold(v1_rt::rc_empty_map::<String, bool>(), |acc: _, entry: _| {
v1_rt::rc_map_insert(acc, entry.name.clone(), true)
})
}

pub fn rt_bridge_function_names() -> Rc<HashMap<String, String>> {
Expand All @@ -594,7 +585,7 @@ pub fn rt_bridge_function_names() -> Rc<HashMap<String, String>> {
.cloned()
.fold(
v1_rt::rc_empty_map::<String, String>(),
|acc: Rc<HashMap<String, String>>, entry: Rc<RuntimeFunction>| {
|acc: Rc<HashMap<String, String>>, entry: _| {
v1_rt::rc_map_insert(acc, entry.name.clone(), entry.bridge_name.clone())
},
)
Expand Down
8 changes: 4 additions & 4 deletions src/v1/stage0/src/std_algebra.rs
Original file line number Diff line number Diff line change
Expand Up @@ -766,10 +766,10 @@ pub fn carrier_container_alias_rows() -> Rc<HashMap<String, String>> {
pub fn carrier_container_roster_map() -> Rc<HashMap<String, bool>> {
algebra_carriers().iter().cloned().fold(
v1_rt::rc_empty_map::<String, bool>(),
|acc: Rc<HashMap<String, bool>>, carrier: Rc<AlgebraCarrier>| {
|acc: _, carrier: Rc<AlgebraCarrier>| {
carrier.spellings.clone().iter().cloned().fold(
acc,
|inner: Rc<HashMap<String, bool>>, spelling: Rc<CarrierSpelling>| {
|inner: _, spelling: Rc<CarrierSpelling>| {
if carrier_spelling_row_present(spelling.container_roster_name.clone()) {
v1_rt::rc_map_insert(inner.clone(), spelling.text.clone(), true)
} else {
Expand Down Expand Up @@ -838,10 +838,10 @@ pub fn algebra_profile_equality_extensional(profile: AlgebraProfile) -> bool {
pub fn carrier_container_equality_rows() -> Rc<HashMap<String, bool>> {
algebra_carriers().iter().cloned().fold(
v1_rt::rc_empty_map::<String, bool>(),
|acc: Rc<HashMap<String, bool>>, carrier: Rc<AlgebraCarrier>| {
|acc: _, carrier: Rc<AlgebraCarrier>| {
carrier.spellings.clone().iter().cloned().fold(
acc,
|inner: Rc<HashMap<String, bool>>, spelling: Rc<CarrierSpelling>| {
|inner: _, spelling: Rc<CarrierSpelling>| {
if carrier_spelling_row_present(spelling.container_algebra_row.clone()) {
v1_rt::rc_map_insert(
inner.clone(),
Expand Down
5 changes: 0 additions & 5 deletions src/v1/stage0/src/std_logic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,3 @@ pub fn classical_or(a: Classical, b: Classical) -> Classical {
Classical::False => b,
}
}

#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub struct True;
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub struct False;
35 changes: 19 additions & 16 deletions src/v1/stage0/src/std_occurrence_binding_candidates.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3358,23 +3358,26 @@ pub fn section13_observation_joins_receipt(
observations: Rc<Vec<Rc<Section13ExactHeadExecutionObservation>>>,
required_head: String,
) -> Option<bool> {
observations.iter().cloned().fold(
std::option::Option::None,
|found: _, observation: Rc<Section13ExactHeadExecutionObservation>| match found.clone() {
Some(_) => found.clone(),
std::option::Option::None => {
if (crate::std_decl_ref::declaration_ref_eq(
observation.declaration.clone(),
receipt.clone(),
) && (observation.head.clone() == required_head.clone()))
{
Some(observation.passed.clone())
} else {
std::option::Option::None
observations
.iter()
.cloned()
.fold(
std::option::Option::None,
|found: _, observation: _| match found.clone() {
Some(_) => found.clone(),
std::option::Option::None => {
if (crate::std_decl_ref::declaration_ref_eq(
observation.declaration.clone(),
receipt.clone(),
) && (observation.head.clone() == required_head.clone()))
{
Some(observation.passed.clone())
} else {
std::option::Option::None
}
}
}
},
)
},
)
}

pub fn section13_adjudicate_row(
Expand Down
2 changes: 1 addition & 1 deletion src/v1/stage0/src/std_occurrence_identity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ pub fn occurrence_id_list_is_prefix_of(
prefix.iter().cloned().fold(Rc::new(OccurrenceIdListPrefixAcc {
path_remaining: path.clone(),
ok: true,
}), |acc: Rc<OccurrenceIdListPrefixAcc>, expected: OccurrenceId| if !acc.ok.clone() {
}), |acc: _, expected: OccurrenceId| if !acc.ok.clone() {
acc.clone()
} else {
if ((acc.path_remaining.clone().len() as i64) == 0) {
Expand Down
6 changes: 2 additions & 4 deletions src/v1/stage0/src/std_pareto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ pub fn dominance_of_comparisons(comparisons: Rc<Vec<AxisComparison>>) -> Dominan
saw_better: false,
saw_worse: false,
},
|acc: DominanceTally, c: AxisComparison| tally_step(acc, c.clone()),
|acc: _, c: AxisComparison| tally_step(acc, c.clone()),
))
}

Expand Down Expand Up @@ -478,9 +478,7 @@ pub fn compare_pair(
a_worse_somewhere: false,
winning_axes: no_axis_ids(),
}),
|acc: Rc<PairAccum>, axis: Rc<SelectionAxis>| {
axis_pair_step(acc, axis.clone(), a.clone(), b.clone())
},
|acc: _, axis: Rc<SelectionAxis>| axis_pair_step(acc, axis.clone(), a.clone(), b.clone()),
))
}

Expand Down
27 changes: 11 additions & 16 deletions src/v1/stage0/src/std_source_annotation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ pub fn advance_line_prefix_indent_only(previous: bool, code_points: Rc<Vec<i64>>
code_points
.iter()
.cloned()
.fold(previous.clone(), |acc: bool, cp: i64| {
.fold(previous.clone(), |acc: _, cp: i64| {
if code_point_is_line_feed(cp.clone()) {
true
} else {
Expand Down Expand Up @@ -265,10 +265,12 @@ pub fn module_root_pick_step(
pub fn module_root_subject(
subjects: Rc<Vec<Rc<AnnotationSubject>>>,
) -> Option<Rc<AnnotationSubject>> {
subjects.iter().cloned().fold(
std::option::Option::None,
|acc: _, row: Rc<AnnotationSubject>| module_root_pick_step(acc.clone(), row.clone()),
)
subjects
.iter()
.cloned()
.fold(std::option::Option::None, |acc: _, row: _| {
module_root_pick_step(acc.clone(), row.clone())
})
}

pub fn earliest_member_start_after(
Expand All @@ -279,7 +281,7 @@ pub fn earliest_member_start_after(
subjects
.iter()
.cloned()
.fold(fallback.clone(), |best: i64, row: Rc<AnnotationSubject>| {
.fold(fallback.clone(), |best: i64, row: _| {
if ((row.span.clone().start.clone() > after.clone())
&& (row.span.clone().start.clone() < best.clone()))
{
Expand Down Expand Up @@ -340,7 +342,7 @@ pub fn annotation_subject_pick(
contained: false,
following: std::option::Option::None,
}),
|acc: Rc<AnnotationSubjectPick>, subject: Rc<AnnotationSubject>| {
|acc: _, subject: _| {
if ((origin.start.clone() >= subject.span.clone().start.clone())
&& (origin.end.clone() <= subject.span.clone().end.clone()))
{
Expand Down Expand Up @@ -399,12 +401,7 @@ pub fn keyed_annotation_rows_agree(
rest: right.clone(),
agreed: true,
}),
|acc: Rc<KeyedAnnotationRowWalk>, row: Rc<KeyedAnnotationRow>| match acc
.rest
.clone()
.first()
.cloned()
{
|acc: _, row: Rc<KeyedAnnotationRow>| match acc.rest.clone().first().cloned() {
std::option::Option::None => Rc::new(KeyedAnnotationRowWalk {
rest: Rc::new(vec![]),
agreed: false,
Expand Down Expand Up @@ -600,9 +597,7 @@ pub fn attach_annotations(
pending: std::option::Option::None,
pending_adjacent: false,
}),
|acc: Rc<AnnotationAttachAcc>, capture: Rc<NormalizedAnnotationCapture>| {
annotation_attach_step(acc, capture.clone(), subjects.clone())
},
|acc: _, capture: _| annotation_attach_step(acc, capture.clone(), subjects.clone()),
);
Rc::new(AnnotationAttachmentResult {
graph: Rc::new(SourceAnnotationGraph {
Expand Down
13 changes: 6 additions & 7 deletions src/v1/stage0/src/v1_compiler_annotation_bind.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ pub fn annotation_subjects(
let items = module_item_entries(transport.clone());
entries.clone().iter().cloned().fold(
Rc::new(vec![]),
|acc: Rc<Vec<Rc<AnnotationSubject>>>, entry: Rc<OccurrenceIndexEntry>| {
|acc: _, entry: Rc<OccurrenceIndexEntry>| {
let depth = entry_ancestor_depth(entry.clone());
let span = entry.projection.clone().diagnostic_span.clone();
if (depth.clone() == 0) {
Expand Down Expand Up @@ -356,13 +356,12 @@ pub fn bind_annotations(
source_length: i64,
) -> Rc<AnnotationAttachmentResult> {
crate::std_source_annotation::attach_annotations(
captures.iter().cloned().fold(
Rc::new(vec![]),
|acc: Rc<Vec<Rc<NormalizedAnnotationCapture>>>,
capture: Rc<UnboundAnnotationCapture>| {
captures
.iter()
.cloned()
.fold(Rc::new(vec![]), |acc: _, capture: _| {
v1_rt::rc_list_push(acc, normalize_dag_annotation(capture.clone()))
},
),
}),
annotation_subjects(transport.clone(), source_length.clone()),
)
}
Expand Down
9 changes: 4 additions & 5 deletions src/v1/stage0/src/v1_compiler_coercion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -623,9 +623,9 @@ pub fn copy_tests() -> Rc<Vec<Rc<CoercionTestEntry>>> {
pub fn unique_inhabitants_for_template_tests(
inhs: Rc<Vec<Rc<InhabitantDecl>>>,
) -> Rc<Vec<Rc<InhabitantDecl>>> {
inhs.iter().cloned().fold(
Rc::new(vec![]),
|acc: Rc<Vec<Rc<InhabitantDecl>>>, inh: Rc<InhabitantDecl>| {
inhs.iter()
.cloned()
.fold(Rc::new(vec![]), |acc: _, inh: _| {
if {
let mut __found = false;
for prev in acc.iter().cloned() {
Expand All @@ -642,8 +642,7 @@ pub fn unique_inhabitants_for_template_tests(
} else {
v1_rt::concat(acc.clone(), Rc::new(vec![inh.clone()]))
}
},
)
})
}

pub fn template_application_tests() -> Rc<Vec<Rc<CoercionTestEntry>>> {
Expand Down
14 changes: 5 additions & 9 deletions src/v1/stage0/src/v1_compiler_compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -646,7 +646,7 @@ pub fn build_dag_key_to_id(order: Rc<Vec<Rc<Node>>>) -> Rc<HashMap<String, Strin
pub fn dag_graph_source_indices(typed: Rc<ResolvedGraph>) -> Rc<HashMap<String, Rc<NewlineIndex>>> {
typed.modules.clone().iter().cloned().fold(
v1_rt::rc_empty_map::<String, Rc<NewlineIndex>>(),
|acc: Rc<HashMap<String, Rc<NewlineIndex>>>, m: Rc<TypedModule>| {
|acc: Rc<HashMap<String, Rc<NewlineIndex>>>, m: _| {
v1_rt::rc_map_merge(acc, m.type_env.clone().source_indices.clone())
},
)
Expand Down Expand Up @@ -2498,9 +2498,7 @@ pub fn front_end_sources(sources: Rc<Vec<Rc<SourceFile>>>) -> Rc<FrontendResult>
});
let intern_table = prepared.iter().cloned().fold(
crate::v1_std_core::empty_intern_table(),
|t: Rc<InternTable>, p: Rc<FrontendPrepared>| {
crate::v1_std_core::pre_intern_tokens(p.tokens.clone(), t)
},
|t: Rc<InternTable>, p: _| crate::v1_std_core::pre_intern_tokens(p.tokens.clone(), t),
);
let parsed = prepared.iter().cloned().fold(
Rc::new(FrontendAccum {
Expand All @@ -2513,7 +2511,7 @@ pub fn front_end_sources(sources: Rc<Vec<Rc<SourceFile>>>) -> Rc<FrontendResult>
annotations: crate::std_source_annotation::source_annotation_graph_empty(),
annotation_diagnostics: Rc::new(vec![]),
}),
|acc: Rc<FrontendAccum>, p: Rc<FrontendPrepared>| {
|acc: Rc<FrontendAccum>, p: _| {
let parsed = crate::v1_compiler_parse::parse_with_table_in_occurrence_scope(
p.tokens.clone(),
v1_rt::rc_map_insert(
Expand Down Expand Up @@ -2641,9 +2639,7 @@ pub fn parse_census_fill_sources(sources: Rc<Vec<Rc<SourceFile>>>) -> Rc<CensusF
});
let intern_table = prepared.iter().cloned().fold(
crate::v1_std_core::empty_intern_table(),
|t: Rc<InternTable>, p: Rc<FrontendPrepared>| {
crate::v1_std_core::pre_intern_tokens(p.tokens.clone(), t)
},
|t: Rc<InternTable>, p: _| crate::v1_std_core::pre_intern_tokens(p.tokens.clone(), t),
);
let parsed = prepared.iter().cloned().fold(
Rc::new(FrontendAccum {
Expand All @@ -2656,7 +2652,7 @@ pub fn parse_census_fill_sources(sources: Rc<Vec<Rc<SourceFile>>>) -> Rc<CensusF
annotations: crate::std_source_annotation::source_annotation_graph_empty(),
annotation_diagnostics: Rc::new(vec![]),
}),
|acc: Rc<FrontendAccum>, p: Rc<FrontendPrepared>| {
|acc: Rc<FrontendAccum>, p: _| {
let parsed = crate::v1_compiler_parse::parse_with_table_in_occurrence_scope(
p.tokens.clone(),
v1_rt::rc_map_insert(
Expand Down
Loading
Loading