Skip to content

Commit 9d88e5c

Browse files
committed
HB.instance: warn on nonlocal declaration in builder mode
1 parent 823139a commit 9d88e5c

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

HB/instance.elpi

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,11 @@ declare-instance Factory T F Clauses CFL CSL :-
292292
declare-canonical-instances-from-factory-and-local-builders Factory
293293
T F TheFactory FGR Clauses CFL CSL.
294294
declare-instance Factory T F Clauses CFL CSL :-
295+
if (not (get-option "local" tt),
296+
current-mode (builder-from U _ _ _), not (T = U))
297+
(coq.warning "HB" "HB.nonlocal-instance-in-builder-mode"
298+
"In builder mode, non-builder instances are always considered local.\n"
299+
"Annotate this HB.instance call with #[local] to fix this warning and improve your code documentation.") true,
295300
declare-canonical-instances-from-factory Factory T F Clauses1 CFL CSL,
296301
if (get-option "export" tt)
297302
(coq.env.current-library File,

0 commit comments

Comments
 (0)