in
if not b then
raise
- (TypeCheckerFailure (lazy ("Case analasys: sort elimination not allowed")));
+ (TypeCheckerFailure (lazy ("Case analysis: sort elimination not allowed")));
(* let's check if the type of branches are right *)
- let parsno =
+ let parsno,constructorsno =
let obj,_ =
try
CicEnvironment.get_cooked_obj ~trust:false CicUniv.empty_ugraph uri
with Not_found -> assert false
in
match obj with
- C.InductiveDefinition (_,_,parsno,_) -> parsno
+ C.InductiveDefinition (il,_,parsno,_) ->
+ let _,_,_,cl =
+ try List.nth il i with Failure _ -> assert false
+ in
+ parsno, List.length cl
| _ ->
raise (TypeCheckerFailure
(lazy ("Unknown mutual inductive definition:" ^
UriManager.string_of_uri uri)))
- in
+ in
+ if List.length pl <> constructorsno then
+ raise (TypeCheckerFailure
+ (lazy ("Wrong number of cases in case analysis"))) ;
let (_,branches_ok,ugraph5) =
List.fold_left
(fun (j,b,ugraph) p ->