@@ -86,13 +86,22 @@ assert!-infer-mixin T M B :-
8686
8787% Given TheType it looks all canonical structure instances on it and makes
8888% all their mixins available for inference
89- pred under-local-canonical-mixins-of.do! i:term, i:list prop.
90- under-local-canonical-mixins-of.do! T P :- std.do! [
89+ pred local-canonical-mixins-of.aux i:term, i:list structure, o:list prop.
90+ local-canonical-mixins-of.aux _ [] [].
91+ local-canonical-mixins-of.aux T [S|Ss] MSL'' :- std.do! [
92+ private.structure-instance->mixin-srcs T S MSL,
93+ MSL => local-canonical-mixins-of.aux T Ss MSL',
94+ std.append MSL MSL' MSL'',
95+ ].
96+
97+ pred local-canonical-mixins-of i:term, o:list prop.
98+ local-canonical-mixins-of T MSL :- std.do! [
9199 get-canonical-structures T CS,
92- std.map CS (private.structure-instance->mixin-srcs T) MSLL,
93- std.flatten MSLL MSL,
94- MSL => std.do! P
95- ].
100+ std.map CS (s\c\ sigma w\ class-def (class c s w)) Cl,
101+ toposort-classes Cl ClSorted,
102+ std.map ClSorted (c\s\ sigma w\ class-def (class c s w)) CSSorted,
103+ local-canonical-mixins-of.aux T CSSorted MSL,
104+ ].
96105
97106% Given TheType and a factory instance (on it), makes all the mixins provided by
98107% the factory available for inference.
@@ -298,7 +307,7 @@ structure-instance->mixin-srcs.aux2 Params T Class (some P) M :-
298307 coq.mk-app (global (const P)) {std.append Params [T,Class]} M.
299308structure-instance->mixin-srcs.aux T F CL :-
300309 factory-instance->new-mixins [] F ML,
301- std.map ML (m\c\ c = mixin-src T m F) CL.
310+ std.map-filter ML (m\c\ not (mixin-src T m _), c = mixin-src T m F) CL.
302311
303312% [factory-instance->new-mixins OldMixins FI MSL] find all the mixins
304313% which can be generated by the factory instance FI which are not part of
0 commit comments