[m-rev.] diff: fix abstract_eqv test for erlang

Peter Wang wangp at students.csse.unimelb.edu.au
Fri Aug 24 12:55:40 AEST 2007


Estimated hours taken: 0.5
Branches: main

Fix a bug in the Erlang back-end where the in-in unification predicate for a
type on the right hand side of an equivalence type was not made visible to
other Erlang modules when the left hand side of the equivalence was abstractly
exported.

compiler/elds_to_erlang.m:
	Use procedure_is_exported to decide if a procedure needs to be
	exported to other Erlang modules rather than status_is_exported.

compiler/hlds_pred.m:
	Add a comment to status_is_exported to refer the reader to
	procedure_is_exported.

Index: compiler/elds_to_erlang.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/elds_to_erlang.m,v
retrieving revision 1.28
diff -u -r1.28 elds_to_erlang.m
--- compiler/elds_to_erlang.m	17 Aug 2007 02:08:37 -0000	1.28
+++ compiler/elds_to_erlang.m	24 Aug 2007 02:30:26 -0000
@@ -179,17 +179,9 @@
 
 output_export_ann(ModuleInfo, Defn, !NeedComma, !IO) :-
     Defn = elds_defn(PredProcId, _, Body, _),
-    PredProcId = proc(PredId, _ProcId),
+    PredProcId = proc(PredId, ProcId),
     module_info_pred_info(ModuleInfo, PredId, PredInfo),
-    pred_info_get_import_status(PredInfo, ImportStatus),
-    ( ImportStatus = status_external(ExternalImportStatus) ->
-        % status_is_exported returns `no' for :- external procedures.
-        IsExported = status_is_exported(ExternalImportStatus)
-    ;
-        IsExported = status_is_exported(ImportStatus)
-    ),
-    (
-        IsExported = yes,
+    ( procedure_is_exported(ModuleInfo, PredInfo, ProcId) ->
         maybe_write_comma(!.NeedComma, !IO),
         nl_indent_line(1, !IO),
         output_pred_proc_id(ModuleInfo, PredProcId, !IO),
@@ -197,7 +189,7 @@
         io.write_int(elds_body_arity(Body), !IO),
         !:NeedComma = yes
     ;
-        IsExported = no
+        true
     ).
 
 :- pred output_foreign_export_ann(elds_foreign_export_defn::in,
Index: compiler/hlds_pred.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/hlds_pred.m,v
retrieving revision 1.231
diff -u -r1.231 hlds_pred.m
--- compiler/hlds_pred.m	15 Aug 2007 01:34:55 -0000	1.231
+++ compiler/hlds_pred.m	24 Aug 2007 02:30:26 -0000
@@ -261,6 +261,8 @@
     %
     % NOTE: this returns `no' for :- external procedures.
     %
+    % See also `procedure_is_exported'.
+    %
 :- func status_is_exported(import_status) = bool.
 
     % Returns yes if the status indicates that the item was exported
--------------------------------------------------------------------------
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