diff: module_qual.m import warnings

Fergus Henderson fjh at cs.mu.oz.au
Sat May 24 03:54:07 AEST 1997


Hi,

Simon, can you please review this one?

compiler/module_qual.m:
	Don't warn about unnecessary interface imports of `string', `int',
	or `float', because such warnings are spurious in the common case
	where the interface uses the type string, int, or float.
	Also, make a few minor improvements to the error messages.

Index: module_qual.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/module_qual.m,v
retrieving revision 1.13
diff -u -r1.13 module_qual.m
--- module_qual.m	1997/02/02 12:41:50	1.13
+++ module_qual.m	1997/05/21 07:17:34
@@ -71,7 +71,18 @@
 	{ mq_info_get_mode_error_flag(Info, UndefModes) },
 	( { ReportErrors = yes } ->
 		{ mq_info_get_interface_modules(Info, UnusedImports0) },
-		{ set__to_sorted_list(UnusedImports0, UnusedImports) },
+		%
+		% We don't warn about modules `int', `float', or `string',
+		% because those warnings are sometimes spurious.
+		% (The types `int', `float', and `string' are defined
+		% in mercury_builtin.m, but arguably they ought to be
+		% defined in int.m, float.m, and string.m, and so if someone
+		% uses the type `int' in the interface, then we don't warn
+		% to warn about `import_module int' in the interface.)
+		%
+		{ set__delete_list(UnusedImports0, ["int", "float", "string"],
+			UnusedImports1) },
+		{ set__to_sorted_list(UnusedImports1, UnusedImports) },
 		maybe_warn_unused_interface_imports(ModuleName, UnusedImports)
 	;
 		[]
@@ -705,14 +716,14 @@
 	write_error_context2(ErrorContext),
 	io__write_string("\n"),
 	prog_out__write_context(Context),
-	io__write_string("  error: multiple possible matches for "),
+	io__write_string("  ambiguity error: multiple possible matches for "),
 	{ id_type_to_string(IdType, IdStr) },
 	io__write_string(IdStr),
 	io__write_string(" "),
 	write_id(Id),
-	io__write_string("\n"),
+	io__write_string(".\n"),
 	prog_out__write_context(Context),
-	io__write_string("  The possible matches are in modules:\n"),
+	io__write_string("  The possible matches are in modules\n"),
 	prog_out__write_context(Context),
 	io__write_string("  "),
 	write_module_list(Modules),
@@ -818,13 +829,12 @@
 					io__state::uo) is det.
 
 write_module_list([Import1, Import2, Import3 | Imports]) --> 
-	io__write_string(Import1),
-	io__write_string(".m, "),
+	io__write_strings("`", Import1, "',"),
 	write_module_list([Import2, Import3 | Imports]).
 write_module_list([Import1, Import2]) -->
-	io__write_strings([Import1, ".m and ", Import2 ,".m"]).
+	io__write_strings(["`", Import1, "' and `", Import2 ,"'"]).
 write_module_list([Import]) -->
-	io__write_string(Import).
+	io__write_strings("`", Import, "',").
 write_module_list([]) -->
 	{ error("module_qual:write_module_list") }.
 

-- 
Fergus Henderson <fjh at cs.mu.oz.au>   |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>   |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3         |     -- the last words of T. S. Garp.



More information about the developers mailing list