Skip to content

Commit 8ce735c

Browse files
authored
Merge pull request #867 from ppedrot/qmap-api
Adapt to rocq-prover/rocq#21020.
2 parents f0ec947 + 58d64b8 commit 8ce735c

File tree

1 file changed

+37
-9
lines changed

1 file changed

+37
-9
lines changed

src/rocq_elpi_builtins.ml

Lines changed: 37 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -424,11 +424,39 @@ let cs_instance = let open Conv in let open API.AlgebraicData in let open Struct
424424
}
425425

426426

427+
[%%if coq = "8.20" || coq = "9.0" || coq = "9.1"]
428+
let cs_entries_for_proj env p =
429+
Structures.CSTable.entries_for ~projection:p
430+
431+
let arguments_names env c =
432+
Arguments_renaming.arguments_names c
433+
434+
let find_arguments_scope env c =
435+
CNotation.find_arguments_scope c
436+
[%%else]
437+
let cs_entries_for_proj env p =
438+
Structures.CSTable.entries_for env ~projection:p
439+
440+
let arguments_names env c =
441+
Arguments_renaming.arguments_names env c
442+
443+
let find_arguments_scope env c =
444+
CNotation.find_arguments_scope env c
445+
[%%endif]
446+
427447
type type_class_instance = {
428448
implementation : GlobRef.t;
429449
priority : int;
430450
}
431451

452+
[%%if coq = "8.20" || coq = "9.0" || coq = "9.1"]
453+
let tc_is_class env gr =
454+
Typeclasses.is_class gr
455+
[%%else]
456+
let tc_is_class env gr =
457+
Typeclasses.is_class env gr
458+
[%%endif]
459+
432460
let tc_instance = let open Conv in let open API.AlgebraicData in declare {
433461
ty = TyName "tc-instance";
434462
doc = "Type class instance with priority";
@@ -2911,7 +2939,7 @@ Supported attributes:
29112939
match proj, value with
29122940
| B.Unspec, B.Unspec -> !: (CSTable.entries ())
29132941
| B.Given p, B.Unspec ->
2914-
!: (CSTable.entries_for ~projection:p)
2942+
!: (cs_entries_for_proj env p)
29152943
| B.Unspec, B.Given v ->
29162944
!: (CSTable.entries () |> List.filter (fun { CSTable.value = v1 } -> ValuePattern.equal env v v1))
29172945
| B.Given p, B.Given v ->
@@ -3005,9 +3033,9 @@ Supported attributes:
30053033

30063034
MLCode(Pred("coq.TC.class?",
30073035
In(gref, "GR",
3008-
Easy "checks if GR is a class"),
3009-
(fun gr ~depth ->
3010-
if Typeclasses.is_class gr then () else raise Pred.No_clause)),
3036+
Read (global, "checks if GR is a class")),
3037+
(fun gr ~depth { env } _ _ ->
3038+
if tc_is_class env gr then () else raise Pred.No_clause)),
30113039
DocAbove);
30123040

30133041
MLData class_;
@@ -3206,10 +3234,10 @@ Supported attributes:
32063234
MLCode(Pred("coq.arguments.name",
32073235
In(gref,"GR",
32083236
Out(list (option id),"Names",
3209-
Easy "reads the Names of the arguments of a global reference. See also the (f (A := v)) syntax.")),
3210-
(fun gref _ ~depth ->
3237+
Read (global, "reads the Names of the arguments of a global reference. See also the (f (A := v)) syntax."))),
3238+
(fun gref _ ~depth { env } _ _ ->
32113239
let open Name in
3212-
!: (try Arguments_renaming.arguments_names gref
3240+
!: (try arguments_names env gref
32133241
|> List.map (function Name x -> Some (Id.to_string x) | _ -> None)
32143242
with Not_found -> []))),
32153243
DocAbove);
@@ -3234,8 +3262,8 @@ Supported attributes:
32343262
MLCode(Pred("coq.arguments.scope",
32353263
In(gref,"GR",
32363264
Out(list (list id),"Scopes",
3237-
Easy "reads the notation scope of the arguments of a global reference. See also the %scope modifier for the Arguments command")),
3238-
(fun gref _ ~depth -> !: (CNotation.find_arguments_scope gref))),
3265+
Read (global, "reads the notation scope of the arguments of a global reference. See also the %scope modifier for the Arguments command"))),
3266+
(fun gref _ ~depth { env } _ _ -> !: (find_arguments_scope env gref))),
32393267
DocAbove);
32403268

32413269
MLCode(Pred("coq.arguments.set-scope",

0 commit comments

Comments
 (0)