Files
mercury/tests/valid/nested_module_bug.m
Simon Taylor 660a24a7ad Fix a bug reported by Michael Day which caused spurious
Estimated hours taken: 8
Branches: main, release

Fix a bug reported by Michael Day which caused spurious
"predicate multiply defined" errors if there were predicates
`module1.p' and `module2.module1.p'.

compiler/hlds_module.m:
	For each of the predicate table search predicates which
	takes a module, add an extra argument which states whether
	the module name passed in is fully qualified. If it is, then
	a search for `module1.p' will not return `module2.module1.p'.
	The module name is guaranteed to be fully qualified for
	the head of predicate, clause, etc. items, and for calls
	occurring in `.opt' files.

	Add a predicate `lookup_builtin_pred_proc_id', for
	looking up the builtin predicates in the predicate table.

compiler/goal_util.m:
	Move code to look up builtin predicates into hlds_module.m.

	Set the builtin_state field of the call goal returned
	by generate_simple_call correctly.

compiler/hlds_pred.m:
	Add a function `calls_are_fully_qualified' which takes
	an import_status, and returns whether calls from goals
	with that status are always fully qualified, which is
	true iff the call is in a `.opt' file.

compiler/prog_io.m:
	Module qualify the sym_names in `:- external' items.

compiler/*.m:
	Fill in the extra argument of predicate table searches.

	Use `lookup_builtin_pred_proc_id' rather than
	`predicate_table_search_*'.

compiler/prog_util.m:
	Add function versions of mercury_*_builtin_module.

compiler/polymorphism.m:
compiler/simplify.m:
compiler/unify_proc.m:
	Use goal_util__generate_simple_call to call builtins,
	rather than duplicating the code.

tests/valid/Mmakefile:
tests/valid/nested_module_bug.m:
tests/valid/intermod_bug_nested.m:
	Test cases.
2003-02-22 13:18:34 +00:00

35 lines
602 B
Mathematica

% Test case for spurious errors if there are predicates
% module1.p and module2.module1.p.
%
:- module nested_module_bug.
:- interface.
:- import_module io.
:- pred main(io__state::di, io__state::uo) is det.
:- implementation.
:- import_module list, parser.
:- import_module nested_module_bug.parser.
main -->
{ parse_tokens("foo", [1,2], List) },
io__write(List),
io__nl.
:- module nested_module_bug.parser.
:- interface.
:- pred parse_tokens(string::in, list(int)::in,
list(int)::out) is det.
:- implementation.
parse_tokens(_, X, X).
:- end_module nested_module_bug.parser.