Skip to content

Commit 35e2530

Browse files
committed
check no module in section at synterp time
1 parent 6f5bcd5 commit 35e2530

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/coq_elpi_builtins_synterp.ml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -734,6 +734,8 @@ type loc-modtypath modtypath -> located.
734734
In(list (pair id modtypath), "Parameters of the functor",
735735
Full(unit_ctx, "Starts a functor *E*")))),
736736
(fun name mp binders ~depth _ _ state ->
737+
if Lib.sections_are_opened () then
738+
err Pp.(str"This code cannot be run within a section since it opens a module");
737739
let ty =
738740
match mp with
739741
| None -> Declaremods.Check []
@@ -773,6 +775,8 @@ coq.env.begin-module Name MP :-
773775
In(list (pair id modtypath), "The parameters of the functor",
774776
Full(unit_ctx,"Starts a module type functor *E*"))),
775777
(fun name binders ~depth _ _ state ->
778+
if Lib.sections_are_opened () then
779+
err Pp.(str"This code cannot be run within a section since it opens a module");
776780
let id = Id.of_string name in
777781
let binders_ast =
778782
List.map (fun (id, mty) ->

0 commit comments

Comments
 (0)