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

Function recursor_refs_rules

crates/compile/src/graph.rs:384–425  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

382 ConstantInfo::CtorInfo(ConstructorVal {
383 cnst: mk_cv("T.mk2"),
384 induct: n("T"),
385 cidx: Nat::from(1u64),
386 num_params: Nat::from(0u64),
387 num_fields: Nat::from(0u64),
388 is_unsafe: false,
389 }),
390 );
391
392 let graph = build_ref_graph(&env);
393 // T references T.mk1 and T.mk2 (from ctors list)
394 assert!(graph.out_refs[&n("T")].contains(&n("T.mk1")));
395 assert!(graph.out_refs[&n("T")].contains(&n("T.mk2")));
396 }
397
398 #[test]
399 fn inductive_all_members_are_not_graph_edges() {
400 // `InductiveVal.all` is Lean source metadata. The canonical compiler
401 // must still split inductive declarations into their minimal SCCs, so
402 // members that do not structurally reference each other are not graph
403 // dependencies merely because Lean recorded them in the same `all` list.
404 let mut env = Env::default();
405 for name in ["A", "B"] {
406 env.insert(
407 n(name),
408 ConstantInfo::InductInfo(InductiveVal {
409 cnst: mk_cv(name),
410 num_params: Nat::from(0u64),
411 num_indices: Nat::from(0u64),
412 all: vec![n("A"), n("B")],
413 ctors: vec![],
414 num_nested: Nat::from(0u64),
415 is_rec: false,
416 is_unsafe: false,
417 is_reflexive: false,
418 }),
419 );
420 }
421
422 let graph = build_ref_graph(&env);
423 assert!(!graph.out_refs[&n("A")].contains(&n("B")));
424 assert!(!graph.out_refs[&n("B")].contains(&n("A")));
425 }
426
427 #[test]
428 fn ctor_includes_induct() {

Callers

nothing calls this directly

Calls 4

build_ref_graphFunction · 0.85
nFunction · 0.70
mk_cvFunction · 0.70
insertMethod · 0.45

Tested by

no test coverage detected