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

specific error for missing subject #479

Merged
merged 3 commits into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
10 changes: 7 additions & 3 deletions HB/instance.elpi
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,17 @@ declare-const Name BodySkel TyWPSkel CSL :- std.do! [
UnfoldClauses => copy SectionTy SectionTyUnfolded,
]) (SectionTy = SectionTyUnfolded),

% call HB.instance TheType TheFactory
std.drop NParams Args [TheType|_],

if (var TheType)
(coq.error "HB: The instance subject must be explicitly given.\nUse:\n HB.instance Definition _ : M <subject> := ...\n HB.instance Definition _ := M.Build <subject> ...")
true,

log.coq.env.add-const-noimplicits-failondup RealName OptimizedBody
SectionTyUnfolded @transparent! C,
TheFactory = (global (const C)),

% call HB.instance TheType TheFactory
std.drop NParams Args [TheType|_],

private.check-non-forgetful-inheritance TheType Factory,

private.declare-instance Factory TheType TheFactory Clauses CSL,
Expand Down
1 change: 1 addition & 0 deletions Makefile.test-suite.coq.local
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ DIFF=\
fi

post-all::
$(call DIFF, tests/err_missin_subject.v)
$(call DIFF, tests/compress_coe.v)
$(call DIFF, tests/about.v)
$(call DIFF, tests/howto.v)
Expand Down
6 changes: 6 additions & 0 deletions tests/err_missin_subject.v
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
From HB Require Import structures.
HB.mixin Record M X := {}.
HB.structure Definition S := { X of M X}.
HB.instance Definition _ : M nat := M.Build _.
HB.instance Definition _ : M _ := M.Build bool.
Fail HB.instance Definition _ : M _ := M.Build _.
5 changes: 5 additions & 0 deletions tests/err_missin_subject.v.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
HB: The command has indeed failed with message:
The instance subject must be explicitly given.
gares marked this conversation as resolved.
Show resolved Hide resolved
Use:
HB.instance Definition _ : M <subject> := ...
HB.instance Definition _ := M.Build <subject> ...
Loading