Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support export locality in coq.TC.declare-instance. #715

Merged
merged 1 commit into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/coq_elpi_builtins.ml
Original file line number Diff line number Diff line change
Expand Up @@ -2781,7 +2781,7 @@ Supported attributes:
Supported attributes:
- @global! (default: true)|}))),
(fun gr priority ~depth { options } _ -> grab_global_env "coq.TC.declare-instance" (fun state ->
let global = if options.local = Some false then Hints.SuperGlobal else Hints.Local in
let global = hint_locality options in
let hint_priority = Some priority in
Classes.existing_instance global gr
(Some { Hints.empty_hint_info with Typeclasses.hint_priority });
Expand Down
26 changes: 22 additions & 4 deletions tests/test_API_TC_CS.v
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,29 @@ Proof.
exact Rr.
Defined.

Check (_ : Reflexive R).
Fail Example ex : Reflexive R := _.

Module TCLocal.
Elpi Query lp:{{ coq.locate "myi" GR, @local! => coq.TC.declare-instance GR 10. }}.
Succeed Example ex : Reflexive R := _.
End TCLocal.

Module TCExport.
Fail Example ex : Reflexive R := _.
Module Mod.
Elpi Query lp:{{ coq.locate "myi" GR, coq.TC.declare-instance GR 10. }}.
End Mod.
Fail Example ex : Reflexive R := _.
Import Mod.
Check (_ : Reflexive R).
Succeed Example ex : Reflexive R := _.
End TCExport.

Module TCGlobal.
Elpi Query lp:{{ coq.locate "myi" GR, @global! => coq.TC.declare-instance GR 10. }}.
End TCGlobal.
Succeed Example ex : Reflexive R := _.

Elpi Query lp:{{coq.locate "myi" GR, coq.TC.declare-instance GR 10. }}.

Check (_ : Reflexive R).

Elpi Query lp:{{coq.TC.db L}}.
Elpi Query lp:{{coq.locate "RewriteRelation" GR, coq.TC.db-for GR L}}.
Expand Down
Loading