aboutsummaryrefslogtreecommitdiff
path: root/pretyping
diff options
context:
space:
mode:
Diffstat (limited to 'pretyping')
-rw-r--r--pretyping/evarconv.ml11
-rw-r--r--pretyping/recordops.ml9
2 files changed, 11 insertions, 9 deletions
diff --git a/pretyping/evarconv.ml b/pretyping/evarconv.ml
index e6e1530e36..ed28cc7725 100644
--- a/pretyping/evarconv.ml
+++ b/pretyping/evarconv.ml
@@ -46,15 +46,10 @@ let () = Goptions.(declare_bool_option {
(* Functions to deal with impossible cases *)
(*******************************************)
let impossible_default_case env =
- let type_of_id =
- let open Names.GlobRef in
- match Coqlib.lib_ref "core.IDProp.type" with
- | ConstRef c -> c
- | VarRef _ | IndRef _ | ConstructRef _ -> assert false
- in
+ let type_of_id = Coqlib.lib_ref "core.IDProp.type" in
let c, ctx = UnivGen.fresh_global_instance env (Coqlib.(lib_ref "core.IDProp.idProp")) in
- let (_, u) = Constr.destConst c in
- Some (c, Constr.mkConstU (type_of_id, u), ctx)
+ let (_, u) = Constr.destRef c in
+ Some (c, Constr.mkRef (type_of_id, u), ctx)
let coq_unit_judge =
let open Environ in
diff --git a/pretyping/recordops.ml b/pretyping/recordops.ml
index 6e3b19ae61..f58cce41cc 100644
--- a/pretyping/recordops.ml
+++ b/pretyping/recordops.ml
@@ -202,7 +202,14 @@ let cs_pattern_of_constr env t =
App (f,vargs) ->
begin
try Const_cs (global_of_constr f) , None, Array.to_list vargs
- with e when CErrors.noncritical e -> raise Not_found
+ with
+ | Not_found when isProj f ->
+ let p, c = destProj f in
+ let { Environ.uj_type = ty } = Typeops.infer env c in
+ let _, params = Inductive.find_rectype env ty in
+ Const_cs (ConstRef (Projection.constant p)), None,
+ params @ [c] @ Array.to_list vargs
+ | e when CErrors.noncritical e -> raise Not_found
end
| Rel n -> Default_cs, Some n, []
| Prod (_,a,b) when Vars.noccurn 1 b -> Prod_cs, None, [a; Vars.lift (-1) b]