mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-16 01:43:35 +00:00
... instead of into raw_compilation_units. Besides being more convenient to
work on, a parse_tree_module_src encodes in its type a significant number
of invariants that a raw_compilation unit does not.
compiler/split_parse_tree_src.m:
Immediately after creating a raw_compilation_unit for one of the modules
in a potentially multi-module source file, convert it to a
parse_tree_module_src.
Fix an old problem that can come up in contrived erroneous code.
Specifically, when a submodule is both nested inside its parent module,
*and* it also has an explicit include_module declaration, we used to
record the contexts of both "inclusions", after generating an error
message. The more rigorous checking that later code now does on the
resulting inclusion map would look at this "duplicate inclusion"
and generate *another* error message. To avoid this redundant message,
do not record the contexts of erroneous inclusions for which a message
has already been generated.
compiler/grab_modules.m:
Operate on parse_tree_module_srcs instead of raw_compilation_units.
This allows us to avoid having code for doing what converting the
raw_compilation_unit to a parse_tree_module_src has already done.
In fact, that conversion code does a better job. The old code assumed
that all implicitly available modules are used in the interface,
whereas in fact only some should be used in the interface, with
the rest being used in the implementation section.
compiler/module_imports.m:
Make the predicates that create module_and_imports structures
take a parse_tree_module_src instead of a raw_compilation_unit
as input. For now, we convert the parse_tree_module_src back to
a raw_compilation_unit for further processing, but I intend
a later diff to change this. Nevertheless, one immediate change
is that init_module_and_imports now stores the *actual*
parse_tree_module_src in the module_and_imports structure,
not a dummy.
compiler/prog_item.m:
Do not include a list of foreign_enum items in the interface section
of a parse_tree_module_src, since such items are not allowed to occur
in interface sections.
For the same reason, delete the field for foreign_enums in the interface
sections of .int0 and .int files.
compiler/check_raw_comp_unit.m:
Operate on parse_tree_module_srcs instead of raw_compilation_units.
compiler/comp_unit_interface.m:
Operate on parse_tree_module_srcs instead of raw_compilation_units.
Do not expect any foreign_enum items in interface sections, since
they are not allowed there.
compiler/read_modules.m:
Provide a mechanism to remember having read a parse_tree_module_src.
compiler/write_module_interface_files.m:
Operate on parse_tree_module_srcs instead of raw_compilation_units.
compiler/get_dependencies.m:
Add a new version of an existing utility predicate. The old one operated
on raw item lists, the new one operates on parse_tree_module_srcs.
To make this possible, factor out the code pieces that operate on
each non-ignored kind of item.
compiler/item_util.m:
Add some new utility predicates/functions.
compiler/convert_parse_tree.m:
Conform to the change in prog_item.m. (We already generated an error
message for a foreign_enum item in the interface, but still passed around
a list of foreign_enum items that was guaranteed to be stay empty.)
compiler/make.module_dep_file.m:
Conform to the changes above.
Use explicit streams in one place.
Do not pass an unneeded argument.
compiler/check_parse_tree_type_defns.m:
compiler/equiv_type.m:
compiler/make_hlds_separate_items.m:
Conform to the change in prog_item.m.
compiler/mercury_compile_main.m:
compiler/module_qual.collect_mq_info.m:
compiler/module_qual.qualify_items.m:
compiler/parse_tree_out.m:
Conform to the changes above.
library/map.m:
library/tree234.m:
Add foldl6, foldl6_values and foldr6 predicates. An earlier version
of this diff needed foldl6, and I added the others for symmetry.
NEWS:
Announce the new library predicates.
tests/invalid/bad_mutable.m:
Export something, to avoid a warning about not exporting anything.
tests/invalid_submodules/duplicate_module.m:
tests/invalid_submodules/duplicate_module_test.m:
Update programming style.
20 lines
594 B
Mathematica
20 lines
594 B
Mathematica
%---------------------------------------------------------------------------%
|
|
% vim: ts=4 sw=4 et ft=mercury
|
|
%---------------------------------------------------------------------------%
|
|
%
|
|
% Test of modules declared as both nested and separate modules.
|
|
% The error occurs in the imported module duplicate_module.m,
|
|
% but it is detected when making the dependencies for this module.
|
|
|
|
:- module duplicate_module_test.
|
|
:- interface.
|
|
:- import_module io.
|
|
|
|
:- pred main(io::di, io::uo) is det.
|
|
|
|
:- implementation.
|
|
:- import_module duplicate_module.
|
|
|
|
mainI(!IO) :-
|
|
duplicate_module.do_main(!IO).
|