[m-dev.] diff: fix spurious error message bug

Fergus Henderson fjh at cs.mu.OZ.AU
Sat Dec 4 00:54:36 AEDT 1999


Estimated hours taken: 0.5

Fix a bug where the compiler was reporting spurious error
messages about "(module `builtin' was not imported)",
similar to the bug exhibited by tests/invalid/builtin_int
that stayl fixed a while ago.

compiler/hlds_module.m:
	Ensure that we always include builtin and private_builtin
	in the list of imported modules, since those modules are
	always automatically imported.

tests/invalid/Mmakefile:
tests/invalid/builtin_proc.m:
tests/invalid/builtin_proc.err_exp:
	Add a regression test.

Workspace: /d-drive/home/hg/fjh/mercury
Index: compiler/hlds_module.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/hlds_module.m,v
retrieving revision 1.48
diff -u -d -r1.48 hlds_module.m
--- compiler/hlds_module.m	1999/07/14 14:56:11	1.48
+++ compiler/hlds_module.m	1999/12/03 13:40:16
@@ -630,12 +630,16 @@
 	map__init(ClassTable),
 	map__init(InstanceTable),
 	map__init(SuperClassTable),
-	set__init(ModuleNames),
+
+	% the builtin modules are automatically imported
+	mercury_public_builtin_module(PublicBuiltin),
+	mercury_private_builtin_module(PrivateBuiltin),
+	set__list_to_set([PublicBuiltin, PrivateBuiltin], ImportedModules),
 
 	assertion_table_init(AssertionTable),
 
 	ModuleSubInfo = module_sub(Name, Globals, [], [], no, 0, 0, [], 
-		[], [], StratPreds, UnusedArgInfo, 0, ModuleNames,
+		[], [], StratPreds, UnusedArgInfo, 0, ImportedModules,
 		no_aditi_compilation, TypeSpecInfo),
 	ModuleInfo = module(ModuleSubInfo, PredicateTable, Requests,
 		UnifyPredMap, QualifierInfo, Types, Insts, Modes, Ctors,
Index: tests/invalid/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/tests/invalid/Mmakefile,v
retrieving revision 1.53
diff -u -d -r1.53 Mmakefile
--- tests/invalid/Mmakefile	1999/11/19 13:22:19	1.53
+++ tests/invalid/Mmakefile	1999/12/03 13:46:24
@@ -14,6 +14,7 @@
 	bigtest.m \
 	bind_var_errors.m \
 	builtin_int.m \
+	builtin_proc.m \
 	circ_type.m \
 	constructor_warning.m \
 	det_errors.m \
Index: tests/invalid/builtin_proc.err_exp
===================================================================
RCS file: builtin_proc.err_exp
diff -N builtin_proc.err_exp
--- /dev/null	Wed May  6 06:32:27 1998
+++ builtin_proc.err_exp	Sat Dec  4 00:46:55 1999
@@ -0,0 +1,3 @@
+builtin_proc.m:013: In clause for predicate `builtin_proc:foo/2':
+builtin_proc.m:013:   error: undefined predicate `builtin:no_such_pred/2'.
+For more information, try recompiling with `-E'.
Index: tests/invalid/builtin_proc.m
===================================================================
RCS file: builtin_proc.m
diff -N builtin_proc.m
--- /dev/null	Wed May  6 06:32:27 1998
+++ builtin_proc.m	Sat Dec  4 00:42:51 1999
@@ -0,0 +1,14 @@
+% Check that compiler/typecheck.m does not add a spurious
+% "(the module `builtin' has not been imported)" to the
+% end of the undefined pred error message.
+:- module builtin_proc.
+
+:- interface.
+
+:- pred foo(int::in, int::out) is det.
+:- pred bar(int::in, int::out) is det.
+
+:- implementation.
+
+foo(X, Y) :- builtin__no_such_pred(X, Y).
+bar(X, Y) :- builtin__copy(X, Y).

-- 
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.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list