mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-19 19:33:46 +00:00
This fixes the second incarnation of Mantis bug #401. (The first incarnation was the handling of such modules when generating target code.) compiler/grab_modules.m: Compute the set of modules that have a use_module declaration in the interface section and an import_module declaration in the implementation section, and set the status of the items imported from that module accordingly. compiler/module_qual.id_set.m: If module A defines an entity (such as a type) that module B refers to without the required qualification (which can happen if B has a use_module, not import_module for A), then do NOT report A as unused in B; it IS used, just not properly. tests/hard_coded/int_impl_imports.exp: tests/hard_coded/int_impl_imports.m: tests/hard_coded/int_impl_imports_2.m: A new test case to see whether we can compile a module that has "int used, imp imported" references to another module, and has unqualified references to an imported entity in the implementation. tests/invalid/int_impl_imports.err_exp: tests/invalid/int_impl_imports.m: tests/invalid/int_impl_imports_2.m: A new test case to see whether we can generate the right error message for a module that has "int used, imp imported" references to another module, and has an unqualified references to an imported entity in the interface. tests/hard_coded/Mmakefile: tests/invalid/Mmakefile: Enable the two new test cases. tests/valid_seq/int_impl_imports.m: tests/valid_seq/int_impl_imports_2.m: Add vim mode lines.
29 lines
796 B
Mathematica
29 lines
796 B
Mathematica
%---------------------------------------------------------------------------%
|
|
% vim: ts=4 sw=4 et ft=mercury
|
|
%---------------------------------------------------------------------------%
|
|
|
|
:- module int_impl_imports.
|
|
:- interface.
|
|
|
|
:- import_module io.
|
|
:- use_module int_impl_imports_2.
|
|
|
|
:- pred main(io::di, io::uo) is det.
|
|
|
|
% This tests whether we can use bar in the interface when module qualified.
|
|
:- type foo == int_impl_imports_2.bar.
|
|
:- pred write_foo(foo::in, io::di, io::uo) is det.
|
|
|
|
:- implementation.
|
|
|
|
:- import_module int_impl_imports_2.
|
|
|
|
main(!IO) :-
|
|
% This tests whether we can refer to one_bar in the implementation section
|
|
% *without* module qualification.
|
|
write_foo(add_bars(one_bar, one_bar), !IO),
|
|
io.nl(!IO).
|
|
|
|
write_foo(Foo, !IO) :-
|
|
io.write_int(Foo, !IO).
|