Skip to content

Commit

Permalink
Merge pull request #583 from LPCIC/fix-synter-impargs
Browse files Browse the repository at this point in the history
Fix synter impargs
  • Loading branch information
gares authored Jan 29, 2024
2 parents 46f23b6 + 9e888e7 commit 6b98188
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 14 deletions.
9 changes: 0 additions & 9 deletions src/coq_elpi_utils.ml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ module EC = EConstr

let safe_destApp sigma t = match EC.kind sigma t with C.App (hd, args) -> (EC.kind sigma hd, args) | x -> (x, [||])
let mkGHole = DAst.make Glob_term.(GHole GInternalHole)
let mkGSort = DAst.make Glob_term.(GSort (UAnonymous { rigid = UState.univ_flexible_alg }))

let mkApp ~depth t l =
match l with
Expand Down Expand Up @@ -212,14 +211,6 @@ let rec list_map_acc f acc = function
let acc, xs = list_map_acc f acc xs in
(acc, x :: xs)

let rec dest_globLam g =
match DAst.get g with
| Glob_term.GLambda (name, _, _, bo) ->
let names, bo = dest_globLam bo in
(name :: names, bo)
| _ -> ([], g)

let is_unknown_constructor x = Names.GlobRef.ConstructRef x = Coqlib.lib_ref "elpi.unknown_constructor"
let rec fix_detype x = match DAst.get x with Glob_term.GEvar _ -> mkGHole | _ -> Glob_ops.map_glob_constr fix_detype x

let detype_qvar sigma q =
Expand Down
5 changes: 1 addition & 4 deletions src/coq_elpi_vernacular.ml
Original file line number Diff line number Diff line change
Expand Up @@ -567,10 +567,7 @@ module Interp = struct
match syndata with
| None -> [], fun ~target:_ ~depth -> Stdlib.Result.Ok ET.mkDiscard
| Some (relocate_term,log) -> log, relocate_term in
let initial_synterp_state =
match synterplog with
| [] -> Vernacstate.Synterp.freeze ()
| x :: _ -> Coq_elpi_builtins_synterp.SynterpAction.synterp_state_after x in
let initial_synterp_state = Vernacstate.Synterp.freeze () in
let query ~depth state =
let state, args, gls = EU.map_acc
(Coq_elpi_arg_HOAS.in_elpi_cmd ~depth ~raw:raw_args Coq_elpi_HOAS.(mk_coq_context ~options:(default_options ()) state))
Expand Down
20 changes: 19 additions & 1 deletion tests/test_synterp.v
Original file line number Diff line number Diff line change
Expand Up @@ -156,4 +156,22 @@ Elpi Accumulate Db db1.
Elpi Accumulate lp:{{ main _. }}.
#[synterp] Elpi Accumulate lp:{{ main _. }}.

Elpi Typecheck.
Elpi Typecheck.

(* ********************************************* *)

Set Implicit Arguments.
Elpi Command foo3.
Elpi Accumulate lp:{{
main _ :-
D = (record "foo" {{ Type }} "mkfoo" (field [] "f" {{ Type }} _\end-record)),
coq.typecheck-indt-decl D ok,
coq.env.add-indt D I, coq.env.begin-module "x" none, coq.env.end-module _.
}}.
#[synterp] Elpi Accumulate lp:{{
main _ :- coq.env.begin-module "x" none, coq.env.end-module _.
}}.
Elpi foo3.



0 comments on commit 6b98188

Please sign in to comment.