Skip to content

Commit

Permalink
[coq_lib] Enforce that boot libraries depend on no theories
Browse files Browse the repository at this point in the history
Signed-off-by: Emilio Jesus Gallego Arias <e+git@x80.org>
  • Loading branch information
ejgallego committed Jun 11, 2022
1 parent f2f42dd commit ddd8f66
Show file tree
Hide file tree
Showing 11 changed files with 39 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/dune_rules/coq_stanza.ml
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,16 @@ module Theory = struct
1.0 version of the Coq language"
]

let boot_has_deps loc =
User_error.raise ~loc
[ Pp.textf "(boot) libraries cannot have dependencies" ]

let check_boot_has_no_deps boot { Buildable.theories; _ } =
if boot then
match theories with
| [] -> ()
| (loc, _) :: _ -> boot_has_deps loc

let decode =
fields
(let+ loc, name = field "name" Coq_lib_name.decode
Expand All @@ -145,6 +155,8 @@ module Theory = struct
and+ modules = Stanza_common.modules_field "modules"
and+ enabled_if = Enabled_if.decode ~allowed_vars:Any ~since:None ()
and+ buildable = Buildable.decode in
(* boot libraries cannot depend on other theories *)
check_boot_has_no_deps boot buildable;
let package = select_deprecation ~package ~public in
{ loc
; name
Expand Down
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Inductive AnotherBegining := Of | The | Universe.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
(coq.theory
(name A)
(package A)
(theories B)
(boot))
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
(lang dune 2.5)

(using coq 0.2)
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Inductive Begining := Of | The | Universe.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
(coq.theory
(name B)
(package B))


Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
(lang dune 2.5)

(using coq 0.2)
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(lang dune 3.2)
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Testing composition with two boot libraries

$ dune build
File "A/dune", line 4, characters 11-12:
4 | (theories B)
^
Error: (boot) libraries cannot have dependencies
[1]

0 comments on commit ddd8f66

Please sign in to comment.