Skip to content

Commit 11a121e

Browse files
authored
Merge pull request #715 from Janno/janno/declare-instance-export-upstream
Support export locality in `coq.TC.declare-instance`.
2 parents 69aac6f + 1e13238 commit 11a121e

File tree

2 files changed

+23
-5
lines changed

2 files changed

+23
-5
lines changed

src/coq_elpi_builtins.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2781,7 +2781,7 @@ Supported attributes:
27812781
Supported attributes:
27822782
- @global! (default: true)|}))),
27832783
(fun gr priority ~depth { options } _ -> grab_global_env "coq.TC.declare-instance" (fun state ->
2784-
let global = if options.local = Some false then Hints.SuperGlobal else Hints.Local in
2784+
let global = hint_locality options in
27852785
let hint_priority = Some priority in
27862786
Classes.existing_instance global gr
27872787
(Some { Hints.empty_hint_info with Typeclasses.hint_priority });

tests/test_API_TC_CS.v

+22-4
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,29 @@ Proof.
1515
exact Rr.
1616
Defined.
1717

18-
Check (_ : Reflexive R).
18+
Fail Example ex : Reflexive R := _.
19+
20+
Module TCLocal.
21+
Elpi Query lp:{{ coq.locate "myi" GR, @local! => coq.TC.declare-instance GR 10. }}.
22+
Succeed Example ex : Reflexive R := _.
23+
End TCLocal.
24+
25+
Module TCExport.
26+
Fail Example ex : Reflexive R := _.
27+
Module Mod.
28+
Elpi Query lp:{{ coq.locate "myi" GR, coq.TC.declare-instance GR 10. }}.
29+
End Mod.
30+
Fail Example ex : Reflexive R := _.
31+
Import Mod.
32+
Check (_ : Reflexive R).
33+
Succeed Example ex : Reflexive R := _.
34+
End TCExport.
35+
36+
Module TCGlobal.
37+
Elpi Query lp:{{ coq.locate "myi" GR, @global! => coq.TC.declare-instance GR 10. }}.
38+
End TCGlobal.
39+
Succeed Example ex : Reflexive R := _.
1940

20-
Elpi Query lp:{{coq.locate "myi" GR, coq.TC.declare-instance GR 10. }}.
21-
22-
Check (_ : Reflexive R).
2341

2442
Elpi Query lp:{{coq.TC.db L}}.
2543
Elpi Query lp:{{coq.locate "RewriteRelation" GR, coq.TC.db-for GR L}}.

0 commit comments

Comments
 (0)