aboutsummaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorHugo Herbelin2019-12-22 20:28:42 +0100
committerHugo Herbelin2020-02-20 09:54:45 +0100
commit4b429f64ee9a36a7151575b914b3af56a300b28b (patch)
tree78da4a1219afcfeafe4bb05be1fda1b7feaf12af /plugins
parent9d427ac1c3fcb3c50623d7a95d97bb578fd381fa (diff)
Fixing #11114 (anomaly with Extraction Implicit on records).
This was due to an inconsistency in handling implicit arguments in the fields and in the constructor of a record.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/extraction/extraction.ml13
1 files changed, 7 insertions, 6 deletions
diff --git a/plugins/extraction/extraction.ml b/plugins/extraction/extraction.ml
index 9b30ddd958..71a3dcfef2 100644
--- a/plugins/extraction/extraction.ml
+++ b/plugins/extraction/extraction.ml
@@ -507,21 +507,22 @@ 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. *)