[m-rev.] diff: bug fix for --high-level-data & existential data types

Fergus Henderson fjh at cs.mu.OZ.AU
Mon Feb 18 16:21:34 AEDT 2002


Estimated hours taken: 0.75
Branches: main

compiler/ml_type_gen.m:
	Fix a bug: when adding the extra type_infos and typeclass_infos
	for existentially quantified data types, the type_infos must
	come before the typeclass_infos.

Workspace: /home/ceres/fjh/mercury
Index: compiler/ml_type_gen.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/ml_type_gen.m,v
retrieving revision 1.22
diff -u -d -r1.22 ml_type_gen.m
--- compiler/ml_type_gen.m	18 Feb 2002 02:54:51 -0000	1.22
+++ compiler/ml_type_gen.m	18 Feb 2002 05:18:55 -0000
@@ -599,15 +599,16 @@
 
 		% generate class members for the type_infos and typeclass_infos
 		% that hold information about existentially quantified
-		% type variables and type class constraints
+		% type variables and type class constraints.
+		% Note that the order of fields is as follows:
+		%	- first typeinfos (for unconstrained type variables)
+		%	- then typeclassinfos (for class constraints)
+		%	- finally the ordinary members
 		( ExistQTVars = [] ->
 			% optimize common case
 			ExtraMembers = [],
 			ArgNum2 = ArgNum0
 		;
-			list__map_foldl(ml_gen_typeclass_info_member(ModuleInfo,
-				Context), Constraints, TypeClassInfoMembers,
-				ArgNum0, ArgNum1),
 			constraint_list_get_tvars(Constraints,
 				ConstrainedTVars),
 			list__delete_elems(ExistQTVars, ConstrainedTVars,
@@ -615,8 +616,11 @@
 			list__map_foldl(
 				ml_gen_type_info_member(ModuleInfo, Context),
 				UnconstrainedTVars, TypeInfoMembers,
+				ArgNum0, ArgNum1),
+			list__map_foldl(ml_gen_typeclass_info_member(ModuleInfo,
+				Context), Constraints, TypeClassInfoMembers,
 				ArgNum1, ArgNum2),
-			list__append(TypeClassInfoMembers, TypeInfoMembers,
+			list__append(TypeInfoMembers, TypeClassInfoMembers,
 				ExtraMembers)
 		),
 

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list