Skip to content

Commit 1235eeb

Browse files
committed
factory-constructor is a function [BUGGY]
since there was a findall we use 'from' to generate all inputs, but this way it could contain duplicates. the right solution is to have a predicate listing (once) each HB generated constant.
1 parent 5e634f1 commit 1235eeb

3 files changed

Lines changed: 11 additions & 2 deletions

File tree

HB/common/database.elpi

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,15 @@ pred findall-mixin-src i:term, o:list mixinname.
231231
findall-mixin-src T ML :-
232232
std.map {std.findall (mixin-src T M_ V_)} mixin-src_mixin ML.
233233

234+
func findall-factory-constructor -> list prop.
235+
findall-factory-constructor L :-
236+
std.map {std.findall (findall-factory-constructor.aux _)} findall-factory-constructor.make L.
237+
pred findall-factory-constructor.aux o:prop.
238+
findall-factory-constructor.aux (factory-constructor F C) :-
239+
from F _ _, factory-constructor F C.
240+
func findall-factory-constructor.make prop -> prop.
241+
findall-factory-constructor.make (findall-factory-constructor.aux P) P.
242+
234243
pred findall-local-canonical o:list constant.
235244
findall-local-canonical CL :-
236245
std.map {std.findall (local-canonical C_)} local-canonical-gref CL.

HB/howto.elpi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ type fdp factoryname -> list mixinname -> list mixinname -> factory_deps_prov.
104104
% get all available factories in the above type
105105
pred list_factories o:list factory_deps_prov.
106106
list_factories FL :-
107-
std.map-filter {std.findall (factory-constructor _ _)} list_factories.aux FL.
107+
std.map-filter {findall-factory-constructor} list_factories.aux FL.
108108
pred list_factories.aux i:prop, o:howto.private.factory_deps_prov.
109109
list_factories.aux (factory-constructor F _) (fdp F DML PML) :-
110110
gref-deps F FD,

HB/structures.v

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ factory-alias->gref GR _ (error Msg) :- !,
141141

142142
% [factory-constructor F K] means K is a constructor for
143143
% the factory F.
144-
pred factory-constructor o:factoryname, o:gref.
144+
func factory-constructor factoryname -> gref.
145145

146146
% [factory-nparams F N] says that F has N parameters
147147
func factory-nparams factoryname -> int.

0 commit comments

Comments
 (0)