Files
mercury/tests/invalid/instances_pc.m
Zoltan Somogyi a39ac69413 Make the code of recompilation.check.m much clearer.
compiler/recompilation.used_file.m:
    To enable some improvements in recompilation.check.m, make a field
    of the used_file structure include more info. Do this by replacing
    a simple list of a module's nested submodules, which cannot
    distinguish between a module being a nested submodule and
    a module being the top module in its source file but having
    *no* submodules (as neither would have nested submodules),
    with a new type equivalent to the maybe_top_module type.
    (Neither that type nor the concept it expresses existed
    when this module was first written.)

    Do this change in a way that narrows the gap between the type
    that represents the contents of .used files, and the type that
    we construct on the way to creating .used files.

    Update the unparsing and parsing code for .used files accordingly.

    Since this is a non-backwards-compatible change, bump the
    version number of the file format.

    Keep a previously-exported function private, since it is needed
    only here.

compiler/recompilation.check.m:
    Give several predicates, types and function symbols more
    descriptive names.

    Delete some comments that the better names have made obsolete,
    and expand and/or update others.

    Move the code used to record the result of a "should we recompile"
    decision to its own predicate.

    Move the code used to handle any nested submodules of the module
    named on the command line next to the code that handles the top
    module in the same source file. The old code included recursive
    invocations of a predicate that made it much harder to see what its
    actual job was.

    Delete three fields of the recompilation_check_info structure.
    Two of those fields, the module name and a flag stating whether
    that module is a nested submodule or not, belong next to the
    module name itself in predicate signatures, and this diff
    puts them there. The third field, the list of the submodules
    nested inside the top module of a source file, is now needed
    in only one place, and so does not need to be passed around.

    Try to get the contents of the .intN files of even the top module
    in the source file from the cache of already-read parse trees.
    We are unlikely to succeed, but the cost of the search is negligible
    compared to the cost of reading and parsing the file.

    Add some XXXs.

compiler/mercury_compile_augment.m:
compiler/mercury_compile_main.m:
compiler/recompilation.usage.m:
    Conform to the changes above. Where relevant, make the same renames
    on predicate and variable names as recompilation.check.m.

The rest of the changes have to do with reducing the number of test case
failures when bootchecking with --use-subdirs, which is needed to enable
the tests in the mmc_make directory. Note that three test cases, all in
tests/mmc_make, still fail, but this does not look to be a regression,
since they failed before this diff as well.

tests/invalid/bad_exported_mode.err_exp2:
tests/invalid/exported_unify.err_exp2:
tests/invalid/instances_pc.instances_pc_helper_1.err_exp2:
tests/invalid_submodules/exported_unify3.err_exp2:
    These expected output files are intended to match diagnostics
    with --use-subdirs. Update them for a whole lot of changes
    (such as the addition of color to error messages, and changes in
    their wording) that have happened since these files were last matched.

tests/invalid_make_int/sub_c.int_err_exp2:
    Add this new expected output file for the --use-subdir case.

tests/invalid/exported_unify.m:
tests/invalid/instances_pc.m:
tests/invalid_make_int/sub_c.m:
tests/invalid_make_int/sub_c.int_err_exp:
    Add a comment to these test source files documenting the role
    of their .err_exp2 files. Conform to the resulting changes
    in line numbers.

tests/mmc_make/Mmakefile:
    Simplify the test for whether we are using --use-subdirs,
    by testing the make variable that tools/bootcheck sets
    during such invocations.

tests/valid_make_int/Mmakefile:
    Fix the dependencies that previously did not work with --use-subdirs.

tests/invalid_make_int/Mmakefile:
    Fix typo.
2025-03-27 00:50:17 +11:00

28 lines
894 B
Mathematica

%---------------------------------------------------------------------------%
% vim: ts=4 sw=4 et ft=mercury
%---------------------------------------------------------------------------%
%
% rotd-2009-04-03 and before failed to detect the overlapping instance
% between this parent module and its child module unless the option
% --intermodule-optimization was enabled, despite the fact that the
% information needed for doing that check is contained in the parent module's
% private interface (.int0) file.
%
% The .err_exp file is for --no-use-subdirs.
% The .err_exp2 file is for --use-subdirs.
%
%---------------------------------------------------------------------------%
:- module instances_pc.
:- interface.
:- typeclass foo(A, B) <= (A -> B) where [].
:- instance foo(int, float).
:- include_module instances_pc_helper_1.
:- implementation.
:- instance foo(int, float) where [].