Skip to content

Commit

Permalink
Merge pull request #768 from ppedrot/hint-opaque-modes
Browse files Browse the repository at this point in the history
Adapt w.r.t. coq/coq#20201.
  • Loading branch information
SkySkimmer authored Feb 10, 2025
2 parents ecd13d0 + e32ee93 commit a857b5b
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/coq_elpi_builtins.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1107,6 +1107,15 @@ let find_hint_db s =
with Not_found ->
err Pp.(str "Hint DB not found: " ++ str s)

[%%if coq = "8.20" || coq = "9.0"]
let hint_mode env gr db =
let modes = Hints.Hint_db.modes db in
List.map (fun a -> Array.to_list a) @@ GlobRef.Map.find gr modes
[%%else]
let hint_mode env gr db =
List.map (fun a -> Array.to_list a) @@ Hints.Hint_db.find_mode env gr db
[%%endif]

let hint_db : (string * Hints.Hint_db.t) Conv.t = {
Conv.ty = B.string.Conv.ty;
Conv.pp_doc = B.string.Conv.pp_doc;
Expand Down Expand Up @@ -2925,11 +2934,9 @@ Supported attributes:|} ^ hint_locality_doc)))),
In(gref, "GR",
In(hint_db, "DB",
Out(B.list (B.list mode), "Modes",
Easy {|Gets all the mode declarations in DB about GR|}))),
(fun gr (_,db) _ ~depth:_ ->
try
let modes = Hints.Hint_db.modes db in
!: (List.map (fun a -> Array.to_list a) @@ GlobRef.Map.find gr modes)
Read(global, {|Gets all the mode declarations in DB about GR|})))),
(fun gr (_,db) _ ~depth:_ { env } _ _ ->
try !: (hint_mode env gr db)
with Not_found ->
!: []
)),
Expand Down

0 comments on commit a857b5b

Please sign in to comment.