@@ -181,6 +181,8 @@ let pr_attributes _ _ _ atts =
181
181
182
182
let wit_elpi_ftactic_arg = EA.Tac.wit
183
183
184
+ let binders = Procq.Constr.binders
185
+
184
186
let def_body = G_vernac.def_body
185
187
186
188
let of_coq_inductive_declaration ~atts kind id =
@@ -195,12 +197,23 @@ let of_coq_record_declaration ~atts kind id =
195
197
| Inductive _ -> assert false
196
198
| Record r -> r
197
199
198
- let of_coq_definition ~loc ~atts name udecl def =
200
+ [%%if coq = "8.20"]
201
+ let of_coq_definition ~loc ~atts name udecl bl def =
202
+ match def with
203
+ | Vernacexpr.DefineBody(bl',red,c,ty) ->
204
+ (* For compatibility with Coq PR #19301, binders have been parsed in advance *)
205
+ assert (List.is_empty bl');
206
+ EA.Cmd.(ConstantDecl { name = snd name; atts; udecl; typ = (bl,ty); red; body = Some c })
207
+ | Vernacexpr.ProveBody _ ->
208
+ CErrors.user_err ~loc Pp.(str"syntax error: missing Definition body")
209
+ [%%else]
210
+ let of_coq_definition ~loc ~atts name udecl bl def =
199
211
match def with
200
- | Vernacexpr.DefineBody(bl, red,c,ty) ->
212
+ | Vernacexpr.DefineBody(red,c,ty) ->
201
213
EA.Cmd.(ConstantDecl { name = snd name; atts; udecl; typ = (bl,ty); red; body = Some c })
202
214
| Vernacexpr.ProveBody _ ->
203
215
CErrors.user_err ~loc Pp.(str"syntax error: missing Definition body")
216
+ [%%endif]
204
217
205
218
}
206
219
@@ -285,8 +298,8 @@ GLOB_PRINTED BY { fun _ _ _ -> EA.Cmd.pp_glob env sigma }
285
298
| [ "Structure" inductive_or_record_definition(id) ] -> { EA.Cmd.RecordDecl (of_coq_record_declaration ~atts:[] Vernacexpr.Structure id) }
286
299
| [ "#[" attributes(atts) "]" "Structure" inductive_or_record_definition(id) ] -> { EA.Cmd.RecordDecl (of_coq_record_declaration ~atts Vernacexpr.Structure id) }
287
300
288
- | [ "Definition" qualified_name(name) univ_decl_opt(udecl) def_body(def) ] -> { of_coq_definition ~loc ~atts:[] name udecl def }
289
- | [ "#[" attributes(atts) "]" "Definition" qualified_name(name) univ_decl_opt(udecl) def_body(def) ] -> { of_coq_definition ~loc ~atts name udecl def }
301
+ | [ "Definition" qualified_name(name) univ_decl_opt(udecl) binders(bl) def_body(def) ] -> { of_coq_definition ~loc ~atts:[] name udecl bl def }
302
+ | [ "#[" attributes(atts) "]" "Definition" qualified_name(name) univ_decl_opt(udecl) binders(bl) def_body(def) ] -> { of_coq_definition ~loc ~atts name udecl bl def }
290
303
291
304
| [ "Axiom" qualified_name(name) univ_decl_opt(udecl) telescope(typ) colon_constr(t) ] -> {
292
305
EA.Cmd.(ConstantDecl { name = snd name; atts = []; udecl; typ = (typ,Some t); red = None; body = None }) }
0 commit comments