[m-dev.] diff: bug fix for TypeClassInfo variables.

David Glen JEFFERY dgj at cs.mu.OZ.AU
Sun Aug 23 15:58:37 AEST 1998


On 22-Aug-1998, Tyson Dowd <trd at cs.mu.OZ.AU> wrote:
> On 22-Aug-1998, David Glen JEFFERY <dgj at cs.mu.OZ.AU> wrote:
> > Noticed that one too, huh? :-)
> > 
> > Your fix is not quite complete because the prescribed order for passing
> > arguments is (from the comment at the top of polymorphism.m):
> > 
> > %       First the UnivTypeClassInfos (for universally quantified constraints)
> > %       then the ExistTypeClassInfos (for existentially quantified constraints)
> > %       then the UnivTypeInfos (for universally quantified type variables)
> > %       then the ExistTypeInfos (for existentially quantified type variables)
> > %       and finally the original arguments of the predicate.
> > 
> > Although your change puts the UnivTypeClassInfos before the 
> > ExistTypeClassInfos, it leaves the type infos before both.
> > 
> > Here is a revised diff. 
> 
> Ok, cool.  The change looks fine.  But then again, I said that
> last time ;-)

Indeed you did. Here's the fix for the fix for the fix: :-)


Estimated hours taken: 1

compiler/polymorphism.m:
	Fix the code which adds C code type-infos to only add type-infos for
	*unconstrained* existentially typed tvars.

Index: polymorphism.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/polymorphism.m,v
retrieving revision 1.145
diff -u -t -r1.145 polymorphism.m
--- polymorphism.m	1998/08/22 14:02:11	1.145
+++ polymorphism.m	1998/08/23 05:52:42
@@ -1168,12 +1168,13 @@
 
 polymorphism__c_code_add_typeinfos(TVars, TypeVarSet,
                 ExistQVars, ArgNames0, ArgNames) :-
-        list__delete_elems(TVars, ExistQVars, UnivQVars),
+        list__filter(lambda([X::in] is semidet, (list__member(X, ExistQVars))),
+                TVars, ExistUnconstrainedVars, UnivUnconstrainedVars),
         in_mode(In),
         out_mode(Out),
-        polymorphism__c_code_add_typeinfos_2(ExistQVars, TypeVarSet,
+        polymorphism__c_code_add_typeinfos_2(ExistUnconstrainedVars, TypeVarSet,
                 Out, ArgNames0, ArgNames1),
-        polymorphism__c_code_add_typeinfos_2(UnivQVars, TypeVarSet,
+        polymorphism__c_code_add_typeinfos_2(UnivUnconstrainedVars, TypeVarSet,
                 In, ArgNames1, ArgNames).
 
 :- pred polymorphism__c_code_add_typeinfos_2(list(tvar),



love and cuddles,
dgj
-- 
David Jeffery (dgj at cs.mu.oz.au) |  Marge: Did you just call everyone "chicken"?
PhD student,                    |  Homer: Noooo.  I swear on this Bible!
Department of Computer Science  |  Marge: That's not a Bible; that's a book of
University of Melbourne         |         carpet samples!
Australia                       |  Homer: Ooooh... Fuzzy.



More information about the developers mailing list