[m-dev.] diff: fix bug with tuples and --high-level-data

Fergus Henderson fjh at cs.mu.OZ.AU
Thu Dec 14 22:45:11 AEDT 2000


Estimated hours taken: 1

compiler/ml_unify_gen.m:
	Fix a bug: it was not handling tuple types properly with
	--high-level-data.  This broke the test cases
		tests/hard_coded/tuple_test and
		tests/hard_coded/typeclasses/tuple_instance
	in grade hl.gc.

Workspace: /home/pgrad/fjh/ws/hg3
Index: compiler/ml_unify_gen.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/ml_unify_gen.m,v
retrieving revision 1.25
diff -u -d -r1.25 ml_unify_gen.m
--- compiler/ml_unify_gen.m	2000/11/23 04:32:45	1.25
+++ compiler/ml_unify_gen.m	2000/12/14 11:35:23
@@ -1491,18 +1491,23 @@
 	;
 		%
 		% With the high-level data representation,
-		% we always used named fields.
+		% we always used named fields, except for
+		% tuple types.
 		% 
 		HighLevelData = yes,
-		FieldName = ml_gen_field_name(MaybeFieldName, ArgNum),
-		(
-			ConsId = cons(ConsName, ConsArity)
-		->
-			unqualify_name(ConsName, UnqualConsName),
-			FieldId = ml_gen_field_id(VarType,
-				UnqualConsName, ConsArity, FieldName)
+		( type_is_tuple(VarType, _) ->
+			FieldId = offset(const(int_const(Offset)))
 		;
-			error("ml_gen_unify_args: invalid cons_id")
+			FieldName = ml_gen_field_name(MaybeFieldName, ArgNum),
+			(
+				ConsId = cons(ConsName, ConsArity)
+			->
+				unqualify_name(ConsName, UnqualConsName),
+				FieldId = ml_gen_field_id(VarType,
+					UnqualConsName, ConsArity, FieldName)
+			;
+				error("ml_gen_unify_args: invalid cons_id")
+			)
 		)
 	},
 	{

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
                                    |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list