Validate a standalone constructor by checking its parent inductive block.
(
&mut self,
ctor_id: &KId<M>,
induct_id: &KId<M>,
)
| 325 | ctors.clone(), |
| 326 | block.clone(), |
| 327 | is_unsafe, |
| 328 | ty.clone(), |
| 329 | ), |
| 330 | _ => { |
| 331 | return Err(TcError::Other("check_inductive: not an inductive".into())); |
| 332 | }, |
| 333 | }; |
| 334 | let ind_arity = checked_metadata_sum::<M>( |
| 335 | "inductive params + indices", |
| 336 | &[params, indices], |
| 337 | )?; |
| 338 | |
| 339 | // Discover all inductives in the mutual block |
| 340 | let block_inds = self.discover_block_inductives(&block)?; |
| 341 | let block_addrs: Vec<Address> = |
| 342 | block_inds.iter().map(|id| id.addr.clone()).collect(); |
| 343 | |
| 344 | // Inductive type must reduce to a Sort after peeling params+indices. |
| 345 | // This must be checked even for inductives with no constructors. |
| 346 | let ind_level = |
| 347 | self.get_result_sort_level(&ty, u64_to_usize(ind_arity)?)?; |
| 348 | |
| 349 | // S3 + S3b: Peer-agreement invariants for mutual inductives. |
| 350 | // |
| 351 | // S3: all peers live in the same result universe. |
| 352 | // S3b: all peers share the same parameter count and parameter-domain |
| 353 | // types. Without S3b, `build_rec_type` — which takes the shared |
| 354 | // param prefix uniformly from `ind_infos[0]` — would produce a |
| 355 | // generated recursor whose param binders misalign with a peer's |
| 356 | // ctor arguments, yielding de-Bruijn-shifted iota reductions and, |
| 357 | // in the limit, ill-typed stored terms. Enforcing agreement |
| 358 | // kernel-side removes the implicit compiler trust. |
| 359 | // |
nothing calls this directly
no test coverage detected