Skip to content

Commit 3352711

Browse files
committed
(HACK) Adapt to rocq-prover/rocq#20674 (stronger synterp/interp checks)
1 parent 68fe617 commit 3352711

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/rocq_elpi_builtins.ml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -990,6 +990,13 @@ let wit_ltac_in_term = Ltac_plugin.Tacarg.wit_tactic
990990
let wit_ltac_in_term = Ltac_plugin.Tacarg.wit_ltac_in_term
991991
[%%endif]
992992

993+
[%%if coq = "8.20" || coq = "9.0" || coq = "9.1"]
994+
let with_hack_synterp f () = f ()
995+
[%%else]
996+
let with_hack_synterp f () =
997+
Flags.with_modified_ref Flags.in_synterp_phase (fun _ -> None) f ()
998+
[%%endif]
999+
9931000
let cache_abbrev_for_tac { abbrev_name; tac_name = tacname; tac_fixed_args = more_args } =
9941001
let action args loc =
9951002
let open Ltac_plugin in
@@ -1018,12 +1025,15 @@ let cache_abbrev_for_tac { abbrev_name; tac_name = tacname; tac_fixed_args = mor
10181025
(TacML (elpi_tac_entry, [TacGeneric(None, tacname); TacGeneric(None, args)])) in
10191026
CAst.make @@ Constrexpr.CGenarg (Genarg.in_gen (Genarg.rawwit wit_ltac_in_term) (CAst.make tac)) in
10201027
let Gbpmp (rule, action) = gbpmp action (List.rev abbrev_name) in
1028+
(* HACK!!! changes the grammar but is called in interp phase *)
1029+
with_hack_synterp (fun () ->
10211030
Pcoq.grammar_extend Pcoq.Constr.term (Pcoq.Fresh
10221031
(Gramlib.Gramext.Before "10",
10231032
[ (None, None, [ Pcoq.Production.make
10241033
(Pcoq.Rule.next rule (Pcoq.Symbol.list0 (Pcoq.Symbol.nterm Pcoq.Constr.arg)))
10251034
action
1026-
])]))
1035+
])])))
1036+
()
10271037

10281038
let subst_abbrev_for_tac (subst, { abbrev_name; tac_name; tac_fixed_args }) = {
10291039
abbrev_name;

0 commit comments

Comments
 (0)