Files
mercury/tests/invalid_submodules/nested_impl_in_int.m
Zoltan Somogyi bd7d7db57d Move nested-module programs from invalid to invalid_submodules.
This is to compile them with "mmake -j1", and thus avoid the intermittent
failures caused by interface files of nested submodules not being ready
when another job, executed in parallel by mmake, wants to read them.

tests/invalid_submodules/children.m:
tests/invalid_submodules/children2.m:
tests/invalid_submodules/duplicate_module.m:
tests/invalid_submodules/duplicate_module_test.err_exp:
tests/invalid_submodules/duplicate_module_test.m:
tests/invalid_submodules/exported_unify3.err_exp:
tests/invalid_submodules/exported_unify3.err_exp2:
tests/invalid_submodules/exported_unify3.m:
tests/invalid_submodules/func_class.err_exp:
tests/invalid_submodules/func_class.m:
tests/invalid_submodules/import_in_parent.err_exp:
tests/invalid_submodules/import_in_parent.m:
tests/invalid_submodules/missing_parent_import.err_exp:
tests/invalid_submodules/missing_parent_import.m:
tests/invalid_submodules/nested_impl_in_int.err_exp:
tests/invalid_submodules/nested_impl_in_int.m:
tests/invalid_submodules/sub_a.m:
tests/invalid_submodules/sub_c.err_exp:
tests/invalid_submodules/sub_c.m:
tests/invalid_submodules/undef_mod_qual.err_exp:
tests/invalid_submodules/undef_mod_qual.m:
tests/invalid_submodules/unresolved_overloading.err_exp:
tests/invalid_submodules/unresolved_overloading.m:
    Move these files, which contain the source code and expected outputs
    of the affected test cases, from the invalid directory to the new
    invalid_submodules directory.

tests/invalid/Mercury.options:
tests/invalid/Mmakefile:
    Delete any mentions of the moved test cases.

    Improve sh programming style in actions.

tests/invalid_submodules/Mercury.options:
tests/invalid_submodules/Mmakefile:
    List *only* the moved test cases. Specify the -j1 flag for mmake.

tests/Mmakefile:
tools/bootcheck:
    Mention the new test directory.

    Request that the list of test directories in these two places be kept
    in sync.

    Note that the feedback test directory is not yet ready.
2019-08-14 23:28:00 +10:00

108 lines
3.0 KiB
Mathematica

%---------------------------------------------------------------------------%
% vim: ts=4 sw=4 et ft=mercury
%---------------------------------------------------------------------------%
%
% "Hello World" in Mercury, using nested modules.
:- module nested_impl_in_int.
:- interface.
:- import_module io.
:- pred main(io::di, io::uo) is det.
:- module nested_impl_in_int.child.
:- interface.
:- import_module io.
:- type foo
---> bar
; baz(int).
:- pred hello(io__state::di, io__state::uo) is det.
:- end_module nested_impl_in_int.child.
:- module nested_impl_in_int.child.
:- implementation.
hello -->
io.write_string("nested_impl_in_int.child.hello\n").
:- end_module nested_impl_in_int:child.
%---------------------------------------------------------------------------%
:- module nested_impl_in_int.child2.
:- interface.
:- import_module io.
:- type foo
---> bar
; baz(int).
:- pred hello(io::di, io::uo) is det.
:- implementation.
hello -->
io.write_string("nested_impl_in_int.child2.hello\n").
:- end_module nested_impl_in_int.child2.
:- implementation.
%---------------------------------------------------------------------------%
% now we're back in the parent module.
:- import_module nested_impl_in_int.child.
:- use_module nested_impl_in_int.child2.
:- import_module require.
:- import_module std_util.
:- type t1 == nested_impl_in_int.child.foo.
:- type t2 == child.foo.
:- type t3 == foo.
:- type t4 == nested_impl_in_int.child2.foo.
% :- type t5 == child2.foo. % XXX mixing of use_module and import_module
% is not yet supported.
:- type t5 == nested_impl_in_int.child2.foo.
main -->
nested_impl_in_int.child.hello,
child.hello,
hello,
nested_impl_in_int.child2.hello,
% child2.hello, % XXX mixing of use_module and import_module
% is not yet supported.
print("t1 = "), print(type_of(has_type_t1)), nl,
print("t2 = "), print(type_of(has_type_t2)), nl,
print("t3 = "), print(type_of(has_type_t3)), nl,
print("t4 = "), print(type_of(has_type_t4)), nl,
print("t5 = "), print(type_of(has_type_t5)), nl,
print("has_type_t1 = "), print(has_type_t1), nl,
print("has_type_t2 = "), print(has_type_t2), nl,
print("has_type_t3 = "), print(has_type_t3), nl,
print("has_type_t4 = "), print(has_type_t4), nl,
print("has_type_t5 = "), print(has_type_t5), nl,
{ true }.
:- func has_type_t1 = t1.
:- func has_type_t2 = t2.
:- func has_type_t3 = t3.
:- func has_type_t4 = t4.
:- func has_type_t5 = t5.
has_type_t1 = nested_impl_in_int.child.bar.
has_type_t2 = child.bar.
has_type_t3 = bar.
has_type_t4 = nested_impl_in_int.child2.bar.
% has_type_t5 = child2:bar. % XXX mixing of use_module and import_module
% is not yet supported.
has_type_t5 = nested_impl_in_int.child2.bar.
:- end_module nested_impl_in_int.