MCPcopy Create free account
hub / github.com/argumentcomputer/ix / compare_ctor_inner

Function compare_ctor_inner

crates/compile/src/compile.rs:2618–2643  ·  view source on GitHub ↗

Compare two constructors by level params, cidx, params, fields, then type.

(
  x: &ConstructorVal,
  y: &ConstructorVal,
  mut_ctx: &MutCtx,
  stt: &CompileState,
)

Source from the content-addressed store, hash-verified

2616 type_root,
2617 });
2618 meta.meta_sharing = indc_surgery_sharing;
2619 meta.meta_univs = indc_meta_univs;
2620 meta.univ_patches = indc_univ_patches;
2621
2622 Ok((data, meta, ctor_const_metas))
2623}
2624
2625/// Compile an Axiom.
2626fn compile_axiom(
2627 val: &AxiomVal,
2628 cache: &mut BlockCache,
2629 stt: &CompileState,
2630) -> Result<(Axiom, ConstantMeta), CompileError> {
2631 cache.compiling = Some(val.cnst.name.clone());
2632 let univ_params = &val.cnst.level_params;
2633
2634 let typ =
2635 compile_expr(&val.cnst.typ, univ_params, &MutCtx::default(), cache, stt)?;
2636 let type_root =
2637 *cache.arena_roots.last().expect("missing axiom type arena root");
2638
2639 // Drain surgery sharing onto this axiom's meta. Axioms can reference
2640 // alpha-collapsed auxiliaries in their type; any collapsed args must
2641 // stay with this axiom rather than leak to the next constant. Same for
2642 // the level-spelling channels (canonicity §10.6).
2643 let arena = std::mem::take(&mut cache.arena);
2644 let surgery_sharing = std::mem::take(&mut cache.surgery_sharing);
2645 let meta_univs: Vec<Arc<Univ>> =
2646 std::mem::take(&mut cache.meta_univs).into_iter().collect();

Callers 1

compare_ctorFunction · 0.85

Calls 2

compare_exprFunction · 0.85
lenMethod · 0.45

Tested by

no test coverage detected