Skip to content

Commit 445410d

Browse files
Rodolphe LepigreJan-Oliver Kaiser
andcommitted
Enforce correct database initialisation.
The `Elpi Db` command used to declare the database for all phases, but only properly initialize it for the current phase. This is no longer the case, and databases must be declared separately (or via `#[phase="both"] Elpi Db`) for each phase. Co-Authored-By: Jan-Oliver Kaiser <[email protected]>
1 parent 1b2b57e commit 445410d

File tree

3 files changed

+13
-10
lines changed

3 files changed

+13
-10
lines changed

Changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
### Commands
66
- New `Elpi Accumulate dbname File filename` allows to accumulate a file int a db
7+
- `Elpi Db` now only creates (and initialises) a database for the specified phase
78

89
### API
910
- New `coq.parse-attributes` support for the `attlabel` specification,

apps/NES/theories/NES.v

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,21 @@ From elpi.apps.NES Extra Dependency "nes_interp.elpi" as nes_interp.
33

44
From elpi Require Import elpi.
55

6-
#[synterp] Elpi Db NES.db lp:{{
6+
#[phase="both"] Elpi Db NES.db lp:{{
77

8-
pred open-ns o:string, o:list string.
9-
:name "open-ns:begin"
10-
open-ns _ _ :- fail.
8+
typeabbrev path (list string).
9+
10+
:index (2)
11+
pred ns o:path, o:modpath.
1112

1213
}}.
1314

14-
#[phase="both"] Elpi Accumulate NES.db lp:{{
15+
#[synterp] Elpi Accumulate NES.db lp:{{
1516

16-
typeabbrev path (list string).
17+
pred open-ns o:string, o:list string.
18+
:name "open-ns:begin"
19+
open-ns _ _ :- fail.
1720

18-
:index (2)
19-
pred ns o:path, o:modpath.
2021
}}.
2122

2223
Elpi Command NES.Status.

src/coq_elpi_vernacular.ml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -463,10 +463,11 @@ let run_in_program ?(program = current_program ()) ?(st_setup=fun x -> x) (loc,
463463
| None -> same_phase Interp P.stage
464464
| Some phase -> same_phase phase P.stage in
465465
let elpi = P.ensure_initialized () in
466-
P.declare_db n;
467-
if do_init then
466+
if do_init then begin
467+
P.declare_db n;
468468
let unit = P.unit_from_string ~elpi loc s in
469469
P.init_db n unit
470+
end
470471

471472
let load_command = P.load_command
472473
let load_tactic = P.load_tactic

0 commit comments

Comments
 (0)