diff: module_qual.m import warnings
Fergus Henderson
fjh at murlibobo.cs.mu.OZ.AU
Sat May 31 03:02:40 AEST 1997
Simon TAYLOR <stayl at students.cs.mu.OZ.AU> writes:
>Actually, it might be better if you changed module_qual:qualify_type to
>call mq_info_set_module_used for each module corresponding to a builtin
>type seen in the interface, rather than just ignoring the warnings for
>string, int and float.
Good scheme. Here's (the relevant portion of) the updated diff.
Index: module_qual.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/module_qual.m,v
retrieving revision 1.14
diff -u -r1.14 module_qual.m
--- module_qual.m 1997/05/21 02:13:40 1.14
+++ module_qual.m 1997/05/30 15:48:38
@@ -84,7 +84,25 @@
module_qual__qualify_type(Type0, Type, Context, Info0, Info) -->
{ mq_info_set_error_context(Info0, type_qual - Context, Info1) },
- qualify_type(Type0, Type, Info1, Info).
+ qualify_type(Type0, Type, Info1, Info2),
+ %
+ % The types `int', `float', and `string' are builtin types,
+ % defined by the compiler, 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 want
+ % to warn about `import_module int' in the interface.
+ %
+ {
+ Type = term__functor(term__atom(Typename), [], _),
+ ( Typename = "int"
+ ; Typename = "string"
+ ; Typename = "float"
+ )
+ ->
+ mq_info_set_module_used(Info2, Typename, Info)
+ ;
+ Info = Info2
+ }.
:- type mq_info
---> mq_info(
--
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