diff options
Diffstat (limited to 'pretyping')
| -rw-r--r-- | pretyping/evarconv.ml | 18 | ||||
| -rw-r--r-- | pretyping/unification.ml | 5 |
2 files changed, 12 insertions, 11 deletions
diff --git a/pretyping/evarconv.ml b/pretyping/evarconv.ml index a82eff9cf0..be21a3a60d 100644 --- a/pretyping/evarconv.ml +++ b/pretyping/evarconv.ml @@ -1310,27 +1310,27 @@ let set_of_evctx l = (** Weaken the existentials so that they can be typed in sign and raise an error if the term otherwise mentions variables not bound in sign. *) let thin_evars env sigma sign c = - let evdref = ref sigma in + let sigma = ref sigma in let ctx = set_of_evctx sign in let rec applyrec (env,acc) t = - match kind sigma t with + match kind !sigma t with | Evar (ev, args) -> - let evi = Evd.find_undefined sigma ev in - let filter = Array.map (fun c -> Id.Set.subset (collect_vars sigma c) ctx) args in + let evi = Evd.find_undefined !sigma ev in + let filter = Array.map (fun c -> Id.Set.subset (collect_vars !sigma c) ctx) args in let filter = Filter.make (Array.to_list filter) in let candidates = Option.map (List.map EConstr.of_constr) (evar_candidates evi) in - let evd, ev = restrict_evar !evdref ev filter candidates in - evdref := evd; whd_evar !evdref t + let evd, ev = restrict_evar !sigma ev filter candidates in + sigma := evd; whd_evar !sigma t | Var id -> - if not (Id.Set.mem id ctx) then raise (TypingFailed sigma) + if not (Id.Set.mem id ctx) then raise (TypingFailed !sigma) else t | _ -> - map_constr_with_binders_left_to_right !evdref + map_constr_with_binders_left_to_right !sigma (fun d (env,acc) -> (push_rel d env, acc+1)) applyrec (env,acc) t in let c' = applyrec (env,0) c in - (!evdref, c') + (!sigma, c') let second_order_matching flags env_rhs evd (evk,args) (test,argoccs) rhs = try diff --git a/pretyping/unification.ml b/pretyping/unification.ml index 00831b5962..a9eb43e573 100644 --- a/pretyping/unification.ml +++ b/pretyping/unification.ml @@ -839,8 +839,9 @@ let rec unify_0_with_initial_metas (sigma,ms,es as subst : subst0) conv_at_top e unify_app_pattern true curenvnb pb opt substn cM f1 l1 cN f2 l2 | _ -> raise ex) - | Case (_,p1,c1,cl1), Case (_,p2,c2,cl2) -> - (try + | Case (ci1,p1,c1,cl1), Case (ci2,p2,c2,cl2) -> + (try + if not (eq_ind ci1.ci_ind ci2.ci_ind) then error_cannot_unify curenv sigma (cM,cN); let opt' = {opt with at_top = true; with_types = false} in Array.fold_left2 (unirec_rec curenvnb CONV {opt with at_top = true}) (unirec_rec curenvnb CONV opt' |
