Skip to content

Commit cf3bd1f

Browse files
SkySkimmerLysxia
authored andcommitted
Adapt to rocq-prover/rocq#18422 (indirect accessor handled through vernactypes)
1 parent 7b18c7f commit cf3bd1f

File tree

3 files changed

+14
-13
lines changed

3 files changed

+14
-13
lines changed

plugin/coqsimpleio.mlg

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ open IOLib
66

77
let run_ast = mk_ref "SimpleIO.IO_Monad.IO.unsafe_run'"
88

9-
let run c =
9+
let run ~opaque_access c =
1010
Feedback.msg_info (Pp.str ("Running " ^ string_of_constr_expr c ^ " ..."));
11-
run ~plugin_name:"coq_simple_io"
11+
run ~plugin_name:"coq_simple_io" ~opaque_access
1212
(CAst.make @@ apply_constr run_ast [c])
1313

1414
let string_unopt = function
@@ -17,7 +17,7 @@ let string_unopt = function
1717
}
1818

1919
VERNAC COMMAND EXTEND RunIO CLASSIFIED AS SIDEFF
20-
| ["RunIO" constr(c)] -> {run c}
20+
| ![opaque_access] ["RunIO" constr(c)] -> {run c}
2121
| ["RunIO" "Include" string(s)] -> { add_extra_dir s }
2222
| ["RunIO" "Open" string(s)] -> { add_module_to_open s }
2323
| ["RunIO" "Package" string(s)] -> { add_extra_pkg s }

plugin/iOLib.ml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -160,11 +160,11 @@ let get_packages mlf =
160160
else [], !extra_pkg
161161

162162
(* Extract the term and its dependencies *)
163-
let extract ~file ident =
163+
let extract ~opaque_access ~file ident =
164164
let warnings = CWarnings.get_flags () in
165165
let mute_extraction = (if warnings = "" then "" else warnings ^ ",") ^ "-extraction-opaque-accessed" in
166166
CWarnings.set_flags mute_extraction;
167-
Flags.silently (Extraction_plugin.Extract_env.full_extraction (Some file)) [qualid_of_ident ident];
167+
Flags.silently (Extraction_plugin.Extract_env.full_extraction ~opaque_access (Some file)) [qualid_of_ident ident];
168168
CWarnings.set_flags warnings
169169

170170
(* Add any modules that have been marked "open" *)
@@ -282,12 +282,12 @@ let run_exec execn =
282282
let compile_and_run dir mlif mlf =
283283
compile dir mlif mlf |> run_exec
284284

285-
let extract_and_run ~plugin_name ident =
285+
let extract_and_run ~plugin_name ~opaque_access ident =
286286
let mlf : string = new_ml_file ~plugin_name in
287287
let mlif : string = Filename.chop_extension mlf ^ ".mli" in
288288
let dir : string = Filename.dirname mlf in
289289

290-
extract ~file:mlf ident;
290+
extract ~opaque_access ~file:mlf ident;
291291
fixup mlif mlf;
292292
copy_dirs dir !extra_dir;
293293
compile_and_run dir mlif mlf
@@ -305,15 +305,15 @@ let define env evd c =
305305
(DefinitionEntry (definition_entry ~univs (EConstr.to_constr evd c))) in
306306
fn
307307

308-
let define_and_run ~plugin_name env evd term =
308+
let define_and_run ~plugin_name ~opaque_access env evd term =
309309
let term = define env evd term in
310-
extract_and_run ~plugin_name term
310+
extract_and_run ~plugin_name ~opaque_access term
311311

312-
let run ~plugin_name term =
312+
let run ~plugin_name ~opaque_access term =
313313
let env = Global.env () in
314314
let evd = Evd.from_env env in
315315
let (term,_) = interp_constr env evd term in
316-
define_and_run ~plugin_name env evd term
316+
define_and_run ~plugin_name ~opaque_access env evd term
317317
(* TODO: clean leftover files *)
318318

319319
let string_of_constr_expr c =

plugin/iOLib.mli

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,6 @@ val reset : unit -> unit
1818
val apply_constr : constr_expr -> constr_expr list -> constr_expr_r
1919
val mk_ref : string -> constr_expr
2020
val string_of_constr_expr : constr_expr -> string
21-
val define_and_run : plugin_name:string -> Environ.env -> Evd.evar_map -> Evd.econstr -> unit
22-
val run : plugin_name:string -> constr_expr -> unit
21+
val define_and_run : plugin_name:string -> opaque_access:Global.indirect_accessor ->
22+
Environ.env -> Evd.evar_map -> Evd.econstr -> unit
23+
val run : plugin_name:string -> opaque_access:Global.indirect_accessor -> constr_expr -> unit

0 commit comments

Comments
 (0)