aboutsummaryrefslogtreecommitdiff
path: root/plugins/extraction/extraction.ml
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/extraction/extraction.ml')
-rw-r--r--plugins/extraction/extraction.ml21
1 files changed, 11 insertions, 10 deletions
diff --git a/plugins/extraction/extraction.ml b/plugins/extraction/extraction.ml
index a4469b7ec1..afc83b780b 100644
--- a/plugins/extraction/extraction.ml
+++ b/plugins/extraction/extraction.ml
@@ -1,7 +1,7 @@
(************************************************************************)
(* * The Coq Proof Assistant / The Coq Development Team *)
-(* v * INRIA, CNRS and contributors - Copyright 1999-2019 *)
-(* <O___,, * (see CREDITS file for the list of authors) *)
+(* v * Copyright INRIA, CNRS and contributors *)
+(* <O___,, * (see version control and CREDITS file for authors & dates) *)
(* \VV/ **************************************************************)
(* // * This file is distributed under the terms of the *)
(* * GNU Lesser General Public License Version 2.1 *)
@@ -437,7 +437,7 @@ and extract_really_ind env kn mib =
Array.mapi
(fun i mip ->
let (_,u),_ = UnivGen.fresh_inductive_instance env (kn,i) in
- let ar = Inductive.type_of_inductive env ((mib,mip),u) in
+ let ar = Inductive.type_of_inductive ((mib,mip),u) in
let ar = EConstr.of_constr ar in
let info = (fst (flag_of_type env sg ar) = Info) in
let s,v = if info then type_sign_vl env sg ar else [],[] in
@@ -507,26 +507,27 @@ and extract_really_ind env kn mib =
assert (Int.equal (List.length field_names) (List.length typ));
let projs = ref Cset.empty in
let mp = MutInd.modpath kn in
- let rec select_fields l typs = match l,typs with
+ let implicits = implicits_of_global (GlobRef.ConstructRef (ip,1)) in
+ let rec select_fields i l typs = match l,typs with
| [],[] -> []
- | _::l, typ::typs when isTdummy (expand env typ) ->
- select_fields l typs
+ | _::l, typ::typs when isTdummy (expand env typ) || Int.Set.mem i implicits ->
+ select_fields (i+1) l typs
| {binder_name=Anonymous}::l, typ::typs ->
- None :: (select_fields l typs)
+ None :: (select_fields (i+1) l typs)
| {binder_name=Name id}::l, typ::typs ->
let knp = Constant.make2 mp (Label.of_id id) in
(* Is it safe to use [id] for projections [foo.id] ? *)
if List.for_all ((==) Keep) (type2signature env typ)
then projs := Cset.add knp !projs;
- Some (GlobRef.ConstRef knp) :: (select_fields l typs)
+ Some (GlobRef.ConstRef knp) :: (select_fields (i+1) l typs)
| _ -> assert false
in
- let field_glob = select_fields field_names typ
+ let field_glob = select_fields (1+npar) field_names typ
in
(* Is this record officially declared with its projections ? *)
(* If so, we use this information. *)
begin try
- let ty = Inductive.type_of_inductive env ((mib,mip0),u) in
+ let ty = Inductive.type_of_inductive ((mib,mip0),u) in
let n = nb_default_params env sg (EConstr.of_constr ty) in
let check_proj kn = if Cset.mem kn !projs then add_projection n kn ip
in