Skip to content

Commit cbdb206

Browse files
committed
warning if more than one mode for a class
1 parent 486609f commit cbdb206

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

apps/tc/elpi/create_tc_predicate.elpi

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,16 @@ coq-mode->elpi mode-ground (pr in "term"). % approximation
1414
coq-mode->elpi mode-input (pr in "term").
1515
coq-mode->elpi mode-output (pr out "term").
1616

17+
% Here we build the elpi modes a class CL. If CL has either zero or more than
18+
% one mode, then we consider all its parameter to be in output mode. If the
19+
% class has exactly one mode, then it is considered for the signature of the
20+
% predicate for CL
1721
pred modes-of-class i:gref, o:list (pair argument_mode string).
1822
modes-of-class ClassGR Modes :-
19-
not (is-option-active {oTC-modes}),
2023
coq.hints.modes ClassGR "typeclass_instances" CoqModesList,
2124
not (CoqModesList = []),
22-
std.assert! (CoqModesList = [HintModesFst]) {calc ("At the moment we only allow TC with one Hint Mode (cause by class" ^ {coq.gref->string ClassGR} ^ ")")},
25+
not (CoqModesList = [_,_|_], coq.warning "TC.Modes" "At the moment we only allow TC with at most 1 hint Mode (caused by class" {coq.gref->string ClassGR} ")"),
26+
CoqModesList = [HintModesFst],
2327
std.append {std.map HintModesFst coq-mode->elpi} [pr out "term"] Modes.
2428
modes-of-class ClassGR Modes :-
2529
coq.env.typeof ClassGR ClassTy,

apps/tc/theories/db.v

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,6 @@ Elpi Db tc_options.db lp:{{
2626
pred oTC-use-pattern-fragment-compiler o:list string.
2727
oTC-use-pattern-fragment-compiler ["TC", "CompilerWithPatternFragment"].
2828

29-
pred oTC-modes o:list string.
30-
oTC-modes ["TC", "Disable", "Modes"].
31-
3229
pred is-option-active i:list string.
3330
is-option-active Opt :-
3431
coq.option.get Opt (coq.option.bool tt).

apps/tc/theories/tc.v

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ Elpi Query lp:{{
4747
sigma Options\
4848
Options = [oTC-ignore-eta-reduction, oTC-resolution-time,
4949
oTC-clauseNameShortName, oTC-time-refine, oTC-debug,
50-
oTC-use-pattern-fragment-compiler, oTC-modes],
50+
oTC-use-pattern-fragment-compiler],
5151
std.forall Options (x\ sigma Args\ x Args,
5252
coq.option.add Args (coq.option.bool ff) ff).
5353
}}.

0 commit comments

Comments
 (0)