diff - mode error messages
Simon TAYLOR
stayl at students.cs.mu.oz.au
Tue Apr 22 18:57:44 AEST 1997
Hi Fergus,
Could you please review this.
Simon.
Estimated hours taken: 0.5
compiler/det_report.m
compiler/mode_errors.m
Use the declared modes when writing error messages.
compiler/hlds_pred.m
Added a predicate proc_info_declared_argmodes which
returns the declared modes if they exist, returning
the inferred modes otherwise.
Index: det_report.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/det_report.m,v
retrieving revision 1.32
diff -u -r1.32 det_report.m
--- det_report.m 1997/02/23 06:06:00 1.32
+++ det_report.m 1997/04/17 07:33:15
@@ -697,7 +697,7 @@
),
{ pred_info_procedures(PredInfo, ProcTable) },
{ map__lookup(ProcTable, ModeId, ProcInfo) },
- { proc_info_argmodes(ProcInfo, ArgModes) },
+ { proc_info_declared_argmodes(ProcInfo, ArgModes) },
prog_out__write_context(Context),
io__write_string(" call to `"),
report_pred_name_mode(PredOrFunc, PredName, ArgModes),
Index: hlds_pred.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/hlds_pred.m,v
retrieving revision 1.29
diff -u -r1.29 hlds_pred.m
--- hlds_pred.m 1997/04/08 02:26:15 1.29
+++ hlds_pred.m 1997/04/22 06:15:01
@@ -684,6 +684,9 @@
:- pred proc_info_maybe_declared_argmodes(proc_info, maybe(list(mode))).
:- mode proc_info_maybe_declared_argmodes(in, out) is det.
+:- pred proc_info_declared_argmodes(proc_info, list(mode)).
+:- mode proc_info_declared_argmodes(in, out) is det.
+
% For a set of variables V, find all the type variables in the types
% of the variables in V, and return set of typeinfo variables for
% those type variables. (find all typeinfos for variables in V).
@@ -876,6 +879,14 @@
proc_info_maybe_declared_argmodes(ProcInfo, MaybeArgModes) :-
ProcInfo = procedure(_, _, _, _, _, _, _,
_, _, _, _, _, _, _, MaybeArgModes).
+
+proc_info_declared_argmodes(ProcInfo, ArgModes) :-
+ proc_info_maybe_declared_argmodes(ProcInfo, MaybeArgModes),
+ ( MaybeArgModes = yes(ArgModes1) ->
+ ArgModes = ArgModes1
+ ;
+ proc_info_argmodes(ProcInfo, ArgModes)
+ ).
% :- type proc_info ---> procedure(
% A maybe(determinism),% _declared_ detism
Index: mode_errors.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/mode_errors.m,v
retrieving revision 1.43
diff -u -r1.43 mode_errors.m
--- mode_errors.m 1997/02/23 06:07:19 1.43
+++ mode_errors.m 1997/04/22 06:36:42
@@ -658,7 +658,7 @@
{ pred_info_procedures(PredInfo, Procs) },
{ pred_info_get_is_pred_or_func(PredInfo, PredOrFunc) },
{ map__lookup(Procs, ProcId, ProcInfo) },
- { proc_info_argmodes(ProcInfo, Modes0) },
+ { proc_info_declared_argmodes(ProcInfo, Modes0) },
{ strip_builtin_qualifiers_from_mode_list(Modes0, Modes) },
{ pred_info_name(PredInfo, Name0) },
{ Name = unqualified(Name0) },
More information about the developers
mailing list