[m-rev.] diff: fix pprint_test for erlang

Peter Wang wangp at students.csse.unimelb.edu.au
Fri Aug 24 14:17:02 AEST 2007


Estimated hours taken: 1
Branches: main

library/type_desc.m:
	When comparing type_descs in Erlang we need to evaluate any functions
	(type_ctor_infos) which are embedded in tuples first before comparing.

Index: library/type_desc.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/type_desc.m,v
retrieving revision 1.50
diff -u -r1.50 type_desc.m
--- library/type_desc.m	5 Jul 2007 02:53:49 -0000	1.50
+++ library/type_desc.m	24 Aug 2007 04:14:20 -0000
@@ -888,10 +888,6 @@
 ").
 
 :- pragma foreign_code("Erlang", "
-    % XXX in these functions we probably should deconstruct the type_infos and
-    % type_ctor_infos and compare the parts manually, as they can contain
-    % functions.
-
     '__Unify____type_desc_0_0'(X0, Y0) ->
         X = eval_if_function(X0),
         Y = eval_if_function(Y0),
@@ -933,7 +929,9 @@
         throw(""foreign code for comparing pseudo_type_desc"").
 
     eval_if_function(X) when is_function(X) -> X();
-    eval_if_function(X)                     -> X.
+    eval_if_function(X) when is_tuple(X) ->
+        list_to_tuple([eval_if_function(E) || E <- tuple_to_list(X)]);
+    eval_if_function(X) -> X.
 ").
 
 %-----------------------------------------------------------------------------%
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to:       mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions:          mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the reviews mailing list