[m-dev.] for review: change typecheck.m to handle type class inference

Fergus Henderson fjh at cs.mu.OZ.AU
Fri Apr 10 01:27:27 AEST 1998


On 31-Mar-1998, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> On 31-Mar-1998, David Glen JEFFERY <dgj at cs.mu.OZ.AU> wrote:
> > Could you avoid these two appends by just calling identical_up_to_renaming
> > twice?
> 
> No.
...
> I'll add a comment.

... and here it is.

Index: typecheck.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/typecheck.m,v
retrieving revision 1.234
diff -u -u -r1.234 typecheck.m
--- typecheck.m	1998/04/08 15:23:35	1.234
+++ typecheck.m	1998/04/09 03:47:47
@@ -510,11 +510,21 @@
 			pred_info_set_class_context(PredInfo4,
 				InferredTypeConstraints, PredInfo),
 			(
-				% if the argument types and the type
+				% If the argument types and the type
 				% constraints are identical up to renaming,
-				% then nothing has changed
-				% (the call to same_length is just an
-				% optimization -- catch the easy cases first)
+				% then nothing has changed.
+				%
+				% Note that we can't compare each of the
+				% parts seperately, since we need to ensure
+				% that the renaming (if any) is consistent
+				% over all the arguments and all the
+				% constraints.  So we need to append all
+				% the relevant types into one big type list
+				% and then compare them in a single call
+				% to indentical_up_to_renaming.
+
+				% The call to same_length here is just an
+				% optimization -- catch the easy cases first.
 				list__same_length(OldTypeConstraints,
 					InferredTypeConstraints),
 				same_structure(OldTypeConstraints,
-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3        |     -- the last words of T. S. Garp.



More information about the developers mailing list