Skip to content

Commit e7c8972

Browse files
authored
Merge pull request #404 from ecranceMERCE/uprec
🐛 Fix declaration of upoly record projections
2 parents aa3f4b4 + 6b25824 commit e7c8972

File tree

2 files changed

+18
-5
lines changed

2 files changed

+18
-5
lines changed

src/coq_elpi_builtins.ml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1863,16 +1863,17 @@ Supported attributes:
18631863
if not (is_mutual_inductive_entry_ground me sigma) then
18641864
err Pp.(str"coq.env.add-indt: the inductive type declaration must be ground. Did you forge to call coq.typecheck-indt-decl?");
18651865
let primitive_expected = match record_info with Some(p, _) -> p | _ -> false in
1866-
let ubinders =
1866+
let (uentry, uentry', ubinders) =
18671867
let open Entries in
18681868
match me.mind_entry_universes with
1869-
| Monomorphic_ind_entry -> (UState.Monomorphic_entry uctx, univ_binders)
1869+
| Monomorphic_ind_entry -> (Monomorphic_entry, UState.Monomorphic_entry uctx, univ_binders)
18701870
| Template_ind_entry _ -> nYI "template polymorphic inductives"
1871-
| Polymorphic_ind_entry uctx -> (UState.Polymorphic_entry uctx, univ_binders)
1871+
| Polymorphic_ind_entry uctx ->
1872+
(Polymorphic_entry uctx, UState.Polymorphic_entry uctx, univ_binders)
18721873
in
18731874
let () = DeclareUctx.declare_universe_context ~poly:false uctx in
18741875
let mind =
1875-
DeclareInd.declare_mutual_inductive_with_eliminations ~primitive_expected me ubinders ind_impls in
1876+
DeclareInd.declare_mutual_inductive_with_eliminations ~primitive_expected me (uentry', ubinders) ind_impls in
18761877
let ind = mind, 0 in
18771878
begin match record_info with
18781879
| None -> () (* regular inductive *)
@@ -1891,7 +1892,7 @@ Supported attributes:
18911892
let fields_as_relctx = Term.prod_assum k_ty in
18921893
let projections =
18931894
Record.Internal.declare_projections ind ~kind:Decls.Definition
1894-
(Entries.Monomorphic_entry, UnivNames.empty_binders)
1895+
(uentry, ubinders)
18951896
(Names.Id.of_string "record")
18961897
flags is_implicit fields_as_relctx
18971898
in

tests/test_API_env.v

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,3 +357,15 @@ Elpi Query lp:{{
357357

358358
}}.
359359

360+
Set Universe Polymorphism.
361+
362+
Elpi Query lp:{{
363+
coq.env.begin-module "Test" none,
364+
Decl = record "Rec" {{ Type }} "BuildRec" (field [] "f" {{ Type }} (_\ end-record)),
365+
@univpoly! =>
366+
coq.env.add-indt Decl _,
367+
coq.env.end-module _.
368+
}}.
369+
370+
Set Printing Universes. Print Module Test.
371+
Check Test.f.

0 commit comments

Comments
 (0)