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

Method count_foralls

crates/kernel/src/check.rs:732–759  ·  view source on GitHub ↗

Count the number of leading foralls in a type.

(&mut self, ty: &KExpr<M>)

Source from the content-addressed store, hash-verified

730 if u64_to_usize::<M>(c.lvls())? != us.len() {
731 return Err(TcError::UnivParamMismatch {
732 expected: c.lvls(),
733 got: us.len(),
734 });
735 }
736 for u in us {
737 let univ_start = timing.as_ref().map(|_| Instant::now());
738 self.validate_univ_params_seen(u, lvl_bound, &mut seen_univs)?;
739 if let (Some(t), Some(start)) = (timing.as_deref_mut(), univ_start)
740 {
741 t.univ += start.elapsed();
742 }
743 }
744 },
745 ExprData::App(f, a, _) => {
746 stack.push((f, depth));
747 stack.push((a, depth));
748 },
749 ExprData::Lam(_, _, ty, body, _) | ExprData::All(_, _, ty, body, _) => {
750 stack.push((ty, depth));
751 let body_depth = depth.checked_add(1).ok_or_else(|| {
752 TcError::Other("binder depth overflow during validation".into())
753 })?;
754 stack.push((body, body_depth));
755 },
756 ExprData::Let(_, ty, val, body, _, _) => {
757 stack.push((ty, depth));
758 stack.push((val, depth));
759 let body_depth = depth.checked_add(1).ok_or_else(|| {
760 TcError::Other("binder depth overflow during validation".into())
761 })?;
762 stack.push((body, body_depth));

Callers 1

check_quotMethod · 0.80

Calls 9

whnfMethod · 0.80
internMethod · 0.80
pushMethod · 0.80
truncateMethod · 0.80
instantiate_revFunction · 0.70
lenMethod · 0.45
cloneMethod · 0.45
dataMethod · 0.45
fresh_fvar_idMethod · 0.45

Tested by

no test coverage detected