@@ -242,6 +242,14 @@ let univpoly_of ~poly ~cumulative =
242242 | true , false -> Poly
243243 | false , _ -> Mono
244244
245+ [%% if coq = " 9.0" || coq = " 9.1" ]
246+ let univpoly_of_flags flags =
247+ univpoly_of ~poly: flags.ComInductive. poly ~cumulative: flags.ComInductive. cumulative
248+ [%% else ]
249+ let univpoly_of_flags flags =
250+ univpoly_of ~poly: (PolyFlags. univ_poly flags.ComInductive. poly) ~cumulative: (PolyFlags. cumulative flags.poly)
251+ [%% endif]
252+
245253let of_coq_inductive_definition id =
246254 let open Vernacentries.Preprocessed_Mind_decl in
247255 let { flags; udecl; typing_flags; private_ind; uniform; inductives } = id in
@@ -254,7 +262,7 @@ let of_coq_inductive_definition id =
254262 List. map (function (Vernacexpr. (_ ,NoCoercion,NoInstance),c ) -> c
255263 | _ -> CErrors. user_err Pp. (str " coercion and instance flags not supported" ))
256264 constructors in
257- let { ComInductive. template; cumulative; poly; finite } = flags in
265+ let { ComInductive. template; finite } = flags in
258266 if template <> None then nYI " raw template polymorphic inductives" ;
259267 if udecl <> None then nYI " raw universe polymorphic inductives with universe declaration" ;
260268 {
@@ -264,7 +272,7 @@ let of_coq_inductive_definition id =
264272 non_uniform_parameters;
265273 arity;
266274 constructors;
267- univpoly = univpoly_of ~poly ~cumulative
275+ univpoly = univpoly_of_flags flags
268276 }
269277
270278let of_coq_record_definition id =
@@ -279,7 +287,7 @@ let of_coq_record_definition id =
279287 match sort.CAst. v with
280288 | Constrexpr. CSort s -> s
281289 | _ -> CErrors. user_err ?loc:sort.CAst. loc Pp. (str " only explicits sorts are supported" )) in
282- let { ComInductive. template; cumulative; poly; finite } = flags in
290+ let { ComInductive. template; finite } = flags in
283291 if template <> None then nYI " raw template polymorphic inductives" ;
284292 if udecl <> None then nYI " raw universe polymorphic inductives with universe declaration" ;
285293 {
@@ -288,7 +296,7 @@ let of_coq_record_definition id =
288296 sort;
289297 constructor = Some idbuild.v;
290298 fields = cfs;
291- univpoly = univpoly_of ~poly ~cumulative
299+ univpoly = univpoly_of_flags flags
292300 }
293301
294302let intern_record_decl glob_sign (it : raw_record_decl ) = glob_sign, it
@@ -461,6 +469,16 @@ let raw_decl_name_to_glob name =
461469
462470let interp_red_expr = Redexpr. interp_redexp_no_ltac
463471
472+ [%% if coq = " 9.0" || coq = " 9.1" ]
473+ let interp_definition ~program_mode poly = ComDefinition. interp_definition ~program_mode
474+ let interp_assumption ~program_mode poly = ComAssumption. interp_assumption ~program_mode
475+ [%% else ]
476+ let interp_definition ~program_mode poly =
477+ ComDefinition. interp_definition ~program_mode ~poly: (PolyFlags. of_univ_poly poly)
478+ let interp_assumption ~program_mode poly =
479+ ComAssumption. interp_assumption ~program_mode ~poly: (PolyFlags. of_univ_poly poly)
480+ [%% endif]
481+
464482let raw_constant_decl_to_constr ~depth coq_ctx state { name; typ = (bl ,typ ); body; red; udecl; atts } =
465483 let env = coq_ctx.env in
466484 let poly =
@@ -482,7 +500,7 @@ let raw_constant_decl_to_constr ~depth coq_ctx state { name; typ = (bl,typ); bod
482500 | Some body , _ ->
483501 let sigma, red = option_map_acc (interp_red_expr env) sigma red in
484502 let sigma, (body, typ), impargs =
485- ComDefinition. interp_definition ~program_mode: false
503+ interp_definition ~program_mode: false poly
486504 env sigma Constrintern. empty_internalization_env bl red body typ
487505 in
488506 let state, gls0 = set_current_sigma ~depth state sigma in
@@ -491,7 +509,7 @@ let raw_constant_decl_to_constr ~depth coq_ctx state { name; typ = (bl,typ); bod
491509 | None , Some typ ->
492510 assert (red = None );
493511 let sigma, typ, impargs =
494- ComAssumption. interp_assumption ~program_mode: false
512+ interp_assumption ~program_mode: false poly
495513 env sigma Constrintern. empty_internalization_env bl typ in
496514 let state, gls0 = set_current_sigma ~depth state sigma in
497515 state, udecl, typ, None , gls0
0 commit comments