Files
mercury/tests/invalid/types.m
Fergus Henderson eae7eec887 Allow modules to be put in source files whose names do not directly match
Estimated hours taken: 10

Allow modules to be put in source files whose names do not directly match
their the module names.  When looking for the source for a module such
as `foo:bar:baz', search for it first in `foo.bar.baz.m', then in `bar.baz.m',
and finally in `baz.m'.

compiler/prog_io.m:
	Change prog_io__read_module so that it returns the name of
	the module read, as determined by the `:- module' declaration.
	Add predicate `check_module_has_expected_name', for checking
	that this name matches what was expected.

compiler/modules.m:
	Add read_mod_from_file, for reading a module given the file name,
	and generated_file_dependencies, for generating the dependencies
	of a module given the file name.  (As opposed to the module name.)
	Change read_mod and read_mod_ignore_errors so that they
	search for `.m' files as described above, and return the name
	of the source file read.
	Also improve the efficiency of read_dependencies slightly:
	when reading in `.int' files, there's no need to call
	split_into_submodules, because we generate a seperate
	`.int' file for each submodule anyway.

compiler/mercury_compile.m:
	Change the handling of command-line arguments.
	Arguments ending with `.m' are assumed to be file names,
	and other arguments are assumed to be module names.
	For file names, call read_mod_from_file instead of read_mod.

compiler/handle_options.m:
	Change help message to reflect the above change to the semantics
	of command-line arguments.

compiler/intermod.m:
compiler/trans_opt.m:
	Fix a bug: call prog_io__read_opt_file instead of prog_io__read_module.

doc/user_guide.texi:
	Document the above change to the semantics of command-line arguments.
	Update the "libraries" chapter to reflect our support for nested
	modules.

tests/*/*.m:
tests/*/*.exp:
	Fix a few incorrect module names in `:- module' declarations.
1998-05-29 08:57:42 +00:00

57 lines
418 B
Mathematica

:- module types.
:- type t ---> a; a; f(t); f(t).
:- pred p(pred).
:- pred q.
q :-
p(q),
zzzzzzzz,
p(2).
r :-
s.
a(X) :- b(X).
r :-
r, a(0).
:- pred z.
z :-
r, a(0).
:- pred foo.
foo :-
bar(_).
:- pred bar(BarTypeParam).
bar(X) :-
X = 0.
:- pred baz(BazTypeParam).
baz(X) :-
bar(X).
:- type t(T1, T2).
:- pred bar2(t(Bar1, Bar2)).
:- pred baz2(t(Baz1, Baz2)).
baz2(X) :-
bar2(X).