Skip to content

Commit d3b2a5f

Browse files
committed
fix: check accumlated clauses in the Db only
1 parent cf6b942 commit d3b2a5f

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

src/coq_elpi_vernacular.ml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,12 +192,14 @@ let run_and_print ~print ~loc program_name program_ast query_ast : _ * Coq_elpi_
192192
| Summary.Stage.Synterp -> Coq_elpi_builtins_synterp.clauses_for_later_synterp
193193
| Summary.Stage.Interp -> Coq_elpi_builtins.clauses_for_later_interp)
194194
state in
195+
196+
(* TODO: this code is duplicate, see set_accumulate_to_db_* *)
195197
let elpi = P.ensure_initialized () in
196198
let clauses_to_add = clauses_to_add |> group_clauses |>
197199
List.map (fun (dbname,asts,vs,scope) ->
200+
let base = P.get_and_compile_existing_db ~loc dbname in
198201
(* maybe this should be a fold otherwise all clauses have to be independent (the second cannot mention the first one) *)
199-
let units = asts |> List.map (fun ast -> P.unit_from_ast ~elpi None ~base:program_ast ~loc ast) in
200-
(* let units = units |> List.map (fun unit -> P.intern_unit (None,unit,flags)) in *)
202+
let units = asts |> List.map (fun ast -> P.unit_from_ast ~elpi None ~base ~loc ast) in
201203
dbname,units,vs,scope) in
202204
clauses_to_add |> List.iter (fun (dbname,units,vs,scope) ->
203205
P.accumulate_to_db dbname units vs ~scope);

tests/test_API2.v

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,3 +404,15 @@ main _ :-
404404
Elpi Accumulate Db foo.db.
405405

406406
Elpi query_foo.
407+
408+
409+
Elpi Command acc_foo.
410+
Elpi Accumulate Db Header foo.db.
411+
Elpi Accumulate lp:{{
412+
pred r i:list int.
413+
main _ :-
414+
coq.elpi.accumulate _ "foo.db" (clause _ _ (r [])).
415+
}}.
416+
Elpi Accumulate Db foo.db.
417+
418+
Fail Elpi acc_foo. (* since r has no type in foo.db *)

0 commit comments

Comments
 (0)