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

Method validate_const_well_scoped_timed

crates/kernel/src/check.rs:435–484  ·  view source on GitHub ↗
(
    &mut self,
    c: &KConst<M>,
    mut timing: Option<&mut ValidationTiming>,
  )

Source from the content-addressed store, hash-verified

433 self.check_recursor_member(id)?;
434 Ok(())
435 },
436
437 KConst::Indc { ty, .. } => {
438 let t = self.infer(ty)?;
439 self.ensure_sort(&t)?;
440 self.check_inductive_member(id)?;
441 Ok(())
442 },
443
444 KConst::Ctor { ty, induct, .. } => {
445 let t = self.infer(ty)?;
446 self.ensure_sort(&t)?;
447 // Validate against the parent inductive (A1–A4 checks).
448 // This ensures standalone ctorInfo is rejected if it doesn't
449 // match its declared inductive.
450 let induct = induct.clone();
451 self.check_ctor_against_inductive_member(id, &induct)?;
452 Ok(())
453 },
454 }
455 }
456
457 fn coordinated_block_for(
458 &mut self,
459 c: &KConst<M>,
460 ) -> Result<Option<KId<M>>, TcError<M>> {
461 match c {
462 KConst::Defn { block, .. } => {
463 self.coordinated_block_if_kind(block, CheckBlockKind::Defn)
464 },
465 KConst::Indc { block, .. } => {
466 self.coordinated_block_if_kind(block, CheckBlockKind::Inductive)
467 },
468 KConst::Ctor { induct, .. } => {
469 let Some(parent) = self.try_get_const(induct)? else {
470 return Ok(None);
471 };
472 match parent {
473 KConst::Indc { block, .. } => {
474 self.coordinated_block_if_kind(&block, CheckBlockKind::Inductive)
475 },
476 _ => Ok(None),
477 }
478 },
479 KConst::Recr { block, .. } => {
480 self.coordinated_block_if_kind(block, CheckBlockKind::Recursor)
481 },
482 KConst::Axio { .. } | KConst::Quot { .. } => Ok(None),
483 }
484 }
485
486 fn coordinated_block_if_kind(
487 &mut self,

Callers 3

check_const_memberMethod · 0.80
check_block_bodyMethod · 0.80

Calls 3

lvlsMethod · 0.80
tyMethod · 0.45

Tested by

no test coverage detected