Commit Graph

29 Commits

Author SHA1 Message Date
Zoltan Somogyi
769412bec5 Attempt to fix a test failure in C# grades ...
... and make the set of test cases in the valid/valid_seq test directories
easier to handle.

tests/valid_seq/call_impure_in_opt_helper_1.m:
    Add a C# definition for a predicate that is defined entirely
    by foreign_procs.

tests/valid/Mmake.valid.common:
    Note the reason why many of the test cases using this file fail
    when executed in C# grades.

    Add a target that I used to debug that problem.

    Put the descriptions of a set of make variables in lexicographic order,
    except for OTHER_PROGS, which has to stay at thee end as it means
    "none of the above". Without this reordering, it was not clear that
    the cause of the failures was NOT a mistake in the spelling of
    one of these variable names.

tests/valid/Mmakefile:
tests/valid_seq/Mmakefile:
    Put the definitions of those make variables in the same order.

tests/Mmake.common:
    Improve programming style.
2023-10-02 19:01:03 +11:00
Zoltan Somogyi
a0d6710407 Use "ts=4 sw=4 expandtab" as modeline ...
... in Mercury.options files.
2023-09-16 19:12:52 +10:00
Zoltan Somogyi
7f64f6eae3 Rename X's aux modules as X_helper_N in valid_seq.
Do this after renaming the main modules of tests that either

- had names that did not even attempt to describe what problem
  they were intended to test for, or
- had names that include either a "test_" prefix or a "_main" suffix.

This ended up renaming most of the modules in this directory. The reason
for this is that many tests' names had an "intermod_" or "nested_" prefix.
This was useful in the valid directory, where these tests originally were,
but it is not useful here, since these tests are in the valid_seq directory
to be executed sequentially *precisely because* they involve multiple modules.

The set of renames of main modules are is:

    func_int_bug_main               ->  func_int_bug
    intermod_bug_nested             ->  spurious_match
    intermod_char                   ->  char_escape_opt
    intermod_dcg_bug                ->  dcg_bug
    intermod_impure                 ->  call_impure_in_opt
    intermod_lambda                 ->  exported_lambda
    intermod_nested                 ->  to_submods_opt
    intermod_nested_module          ->  read_submod_opt
    intermod_nested_module_bug      ->  mode_from_int0_opt
    intermod_nested_uniq            ->  head_var_unify_uniq
    intermod_quote                  ->  opt_file_quote
    intermod_record                 ->  field_access_funcs
    intermod_test                   ->  overload_resolution
    intermod_type_spec              ->  type_spec_vars
    intermod_typeclass_exist        ->  typeclass_exist_opt
    intermod_typeclass              ->  typeclass_in_opt
    intermod_pragma_import          ->  foreign_proc_import
    intermod_ua_type_spec           ->  unused_args_type_spec
    intermod_user_equality_nested   ->  user_eq_pred_nested
    intermod_user_equality          ->  user_eq_pred_nonnested
    intermod_user_sharing           ->  sharing_in_opt
    module_a                        ->  indirect_import_two_paths
    module_b                        ->  indirect_import_one_path
    module_c                        ->  DELETED
    module_d                        ->  DELETED
    module_e                        ->  DELETED
    nested_module_bug               ->  nested_module_ambiguity
    nested_mod_type_bug             ->  type_exported_to_submods
    parsing_bug_main                ->  parsing_bug
    test_xmlreader                  ->  xmlreader

Each of the new main modules includes a note about its previous name.

The old files module_[bcd].m were each used by two or more tests,
definitely including module_a and module_b, and including
module_c and module_d for some of them. The module_c and module_d tests
did not test anything that module_b did not test, and the module_e test
did not test anything useful at all, which is why this diff deletes them.
The diff also ensures that the module_a and module_b tests, under their
new names, now used disjoint sets of helper modules.

Add a note to module_a, under its new name, indirect_import_two_paths,
that despite an original log message saying that it tests importing
the same module via both direct and indirect paths, there is no actual
indirect import of the module in question.
2023-09-10 15:54:13 +10:00
Zoltan Somogyi
f6c0835246 Move tests/valid/empty_submodule.m to valid_seq.
It contains a submodule, and parallel mmake can cause spurious failures.
2023-09-08 12:19:53 +10:00
Zoltan Somogyi
8e32ce0c7f Allow use_module declarations in .int2 files ...
... for modules referenced in the definitions of equivalence types.

compiler/comp_unit_interface.m:
    Add use_module declarations for modules referenced by the right hand sides
    of equivalence type definitions to the implementation sections of .int2
    files.

    Update the names of some of the predicates involved.

    Make the definitions of the predicates accumulate_modules_in_type and
    accumulate_modules_in_qual_type, which do *almost* the same job,
    as similar to each other as possible.

compiler/make_hlds_separate_items.m:
    Allow use_module declarations in the implementation sections of .int2
    files.

compiler/grab_modules.m:
    Ensure that we grab the .int2 files of any modules that have use_module
    declarations for them in the implementation sections of .int2 files.

tests/valid_seq/bug563.m:
tests/valid_seq/bug563_helper_1.m:
tests/valid_seq/bug563_helper_2.m:
    The test case from the Mantis bug report, renamed.

tests/valid_seq/Mmakefile:
    Enable the new test case.
2023-09-04 15:00:38 +10:00
Zoltan Somogyi
eba4f307d9 Add inst_lookup_debug, and use it to fix a bug.
compiler/inst_lookup.m:
    Add inst_lookup_debug, a new version of the inst_lookup predicate
    intended to debug problems with inst names. It can recognize and report
    without crashing two kinds of problems with inst names:

    - unknown inst names, situations in which an inst name identifies
      an entry in an inst table that indicates that an operation on insts
      has begun but has not yet completed, which is a problem if all such
      operations are supposed to have completed, abd

    - missing inst names, situations in which an inst name *should* identify
      an entry in an inst table, but that entry does not exist. In such cases,
      the inst name is effectively a form of dangling pointer.

    It reports both kinds of problems by return user insts of a special form
    that another predicate can recognize, and which contain all the info
    available about the error.

compiler/hlds_inst_mode.m:
    Add predicates to search the inst tables, to allow inst_lookup_debug
    to use its own code to handle search failures.

    Add predicates to return the contents of the four subtables of the
    unify inst table separately, and to rebuild the unify inst table
    from the versions of those four components. This is to help with
    a change to equiv_type_hlds.m that is explained below.

    Delete a no-longer-needed predicate.

compiler/parse_tree_to_term.m:
    Export some utility functions for use by inst_lookup_debug.

compiler/error_msg_inst.m:
    Use inst_lookup_debug instead of inst_lookup to "look up" inst names.
    When this returns an indication of an error, format the component insts
    of the erroneous insts nicely.

compiler/hlds_out_inst_table.m:
    When we print out entries in the unify inst table, merge inst table
    and the other inst tables, make it easier to see *which* table's entry
    we are looking at.

compiler/equiv_type_hlds.m:
    Fix a bug. The bug was this code in expanding out equivalence types
    in merge_inst_infos:

    ( if ChangedA = unchanged, ChangedB = unchanged then
        Changed = unchanged,
        MergeInstInfo = merge_inst_info(InstA, InstB)
    else
        Changed = changed,
        MergeInstInfo = MergeInstInfo0
    ).

    The lack of the update in the changed case led to properly-updated
    merge insts becoming dangling insts, which caused a compiler abort
    on their next lookup in the merge inst table. The reason why this
    bug hasn't appeared before is that such lookups are rarely done
    after equiv_type_hlds is invoked.

    Change a lambda expression involved in this bug to a predicate,
    to simplify putting an mdb breakpoint on it.

    Since the error may have been caused by the inconsistency of

    - some switches on Changed having the unchanged case first,
    - with other switches on Changed having the changed case first,

    make all switches put the unchanged case first, checking that
    none make the same mistake.

    Expand out type equivalences in each of the four subtables of the
    unify inst table separately, to both simplify and speed up the process
    of getting the key/value pairs out of the table and putting them
    back again.

tests/valid_seq/merge_inst_bug.m:
tests/valid_seq/merge_inst_bug_helper_1.m:
    Add a cut-down version of the original bug report program
    as a regression test.

tests/valid_seq/Mmakefile:
    Enable the new test case.
2023-08-13 12:39:56 +02:00
Julien Fischer
26ef7cdf15 Fix typo.
tests/valid_seq/xml_event_read.m:
    As above.
2023-01-07 16:48:40 +11:00
Julien Fischer
f3a34e4651 Replace uses of __ as a module qualifier.
samples/muz.zbstract.m:
tests/*/*.m:
    As above.
2022-04-14 20:25:10 +10:00
Julien Fischer
5d0acda798 Delete obsolete predicates from builtin module.
library/builtin:
    Delete the promise_only_solution/1 and promise_only_solution_io/4. Both
    have have been marked as obsolete since 2015.

    Also delete the non-public impure versions of those, get_one_solution/1
    and get_one_solution_io/4. Implementing the pure versions was the only
    use of these.

compiler/hlds_goal.m:
    Delete a reference to promise_only_solution in a comment.

tests/declarative_debugger/trust.exp:
tests/declarative_debugger/trust.inp:
tests/declarative_debugger/trust_1.m:
     Replace a call to promise_only_solution/1; this does simplify this test
     a little, but does not affect what the trust_1 module was testing, namely
     the user-defined comparison on the type exported by that module.

tests/declarative_debugger/exceptions.m:
tests/hard_coded/myset.m:
tests/hard_coded/user_compare.m:
tests/valid_seq/intermod_nested_module_bug2.m:
extras/curs/samples/nibbles.m:
     Replace calls to the now deleted predicates.
2022-04-13 15:09:21 +10:00
Zoltan Somogyi
d710c436f0 Fix quoting of attributes in type defns.
This fixes Mantis bug #545.

compiler/parse_tree_out.m:
    Put brackets around functor names in "where direct_arg is" attributes.

compiler/mercury_to_mercury.m:
    Provide a function for doing that.

tests/valid_seq/xml_event_read.m:
tests/valid_seq/xml_event_read_helper.m:
    A slightly modified version of the Mantis test case.

tests/valid_seq/Mmakefile:
tests/valid_seq/Mercury.options:
    Enable the new test case, and compile it with intermodule optimization
    to (try to) tickle the bug.
2022-02-09 19:46:05 +11:00
Zoltan Somogyi
b64f0fbedc Add a "mercury_term_" prefix to lexer.m/parser.m.
library/mercury_term_lexer.m:
library/mercury_term_parser.m:
    As above.

NEWS:
    Announce the change.

browser/interactive_query.m:
compiler/analysis.file.m:
compiler/fact_table.m:
compiler/make.module_dep_file.m:
compiler/parse_module.m:
compiler/parse_tree_out_term.m:
compiler/recompilation.used_file.m:
library/MODULES_DOC:
library/char.m:
library/integer.m:
library/io.m:
library/library.m:
library/ops.m:
library/term.m:
library/term_io.m:
mdbcomp/trace_counts.m:
tests/hard_coded/impl_def_lex.m:
tests/hard_coded/impl_def_lex_string.m:
tests/hard_coded/lco_pack_args_3.m:
tests/hard_coded/lexer_bigint.m:
tests/hard_coded/lexer_ints.m:
tests/hard_coded/lexer_zero.m:
tests/hard_coded/parse_number_from_string.m:
tests/valid_seq/nested_module_bug.m:
    Conform to the change.
2021-12-31 02:38:07 +11:00
Zoltan Somogyi
8827b6a466 Make --halt-at-invalid-interface the default.
NEWS:
    Mention this fact.

    Group related changes together.

    Fix some typos.

compiler/error_util.m:
    Let the halt_at_invalid_interface option govern whether we print error
    messages when we generate .int/.int2 files, rather than
    the print_errors_warnings_when_generating_interface option.
    This simplifies the use of that option.

compiler/options.m:
doc/user_guide.texi:
    Document the halt_at_invalid_interface option.

    Delete the print_errors_warnings_when_generating_interface option,
    since its functionality has been subsumed into halt_at_invalid_interface.

compiler/grab_modules.m:
    Check the accessibility of imported modules not just when generating target
    language code, but also when generating .int/.int2 files. Without this,
    the test_nested test case, which this diff moves from invalid to
    invalid_make_int, would miss out on some errors being reported
    in its new home.

    To make the above possible, refactor the code that does the check
    to let it work on aug_make_int_units as well as from aug_compilation_units.
    Make the wording of any error message depend on where the info came from,
    because unlike aug_comp_units, aug_make_int_units work with an
    known-incomplete picture of the relevant info.

    Update some obsolete comments.

compiler/write_module_interface_files.m:
    Add a comment about a design decision that affects this diff.

tests/invalid_make_int/Mercury.options:
tests/invalid_make_int/Mmakefile:
    Add to this directory's list the test cases that this diff moves
    to this directory from other test directories, because the errors
    that they test for are now reported at interface generation time.

    Fix the rule handling multimodule tests, now that we have some :-(

    Specify -j1 for this directory, since the two tests moved here
    from invalid_submodules include nested submodules.

tests/invalid_make_int/bad_type_class_constraint_intermodule.{m,int_err_exp}:
    Move this test case here from invalid, renaming files slightly,
    and update the expected output.

tests/invalid_make_int/bug499.{m,int_err_exp}:
    Move this test case here from invalid, and update the expected output.

tests/invalid_make_int/int_impl_imports.{m,int_err_exp}:
tests/invalid_make_int/int_impl_imports_2.m:
    Move this test case here from invalid, and update the expected output.

tests/invalid_make_int/missing_interface_import2.{m,int_err_exp}:
tests/invalid_make_int/missing_interface_import3.m:
    Move this test case here from invalid, and update the expected output.

tests/invalid_make_int/missing_parent_import.{m,int_err_exp}:
tests/invalid_make_int/children.m:
tests/invalid_make_int/children2.m:
    Move this test case here from invalid_submodules,
    and update the expected output.

tests/invalid_make_int/sub_c.{m,int_err_exp}:
tests/invalid_make_int/sub_a.m:
    Move this test case here from invalid_submodules,
    and update the expected output.

tests/invalid_make_int/test_nested.{m,int_err_exp}:
tests/invalid_make_int/parent.m:
tests/invalid_make_int/parent.private_child.m:
tests/invalid_make_int/parent.public_child.m:
tests/invalid_make_int/parent.undeclared_child.m:
tests/invalid_make_int/parent2.child.m:
tests/invalid_make_int/parent2.m:
    Move this test case here from invalid, and update the expected output.

tests/invalid_make_int/transitive_import.{m,int_err_exp}:
    Move this test case here from invalid, update it,
    and update the expected output.

tests/invalid/Mmakefile:
    Delete from the list of tests in this directory the tests
    moved to invalid_make_int, and test bug521.

tests/invalid/bug521.{m,err_exp}:
tests/invalid/bug521_sub.m:
    Delete this test. invalid_make_int already had a copy of the relevant
    part of this test.

tests/invalid_submodules/Mmakefile:
    Delete from the list of tests in this directory the two tests
    moved to invalid_make_int.

    Delete from the list of tests in this directory two other tests
    for which we now detect some or all of the errors tested for
    at interface generation time, but which are already covered
    by other tests.

tests/valid_make_int/Mmakefile:
    Delete from the list of tests in this directory the test
    moved to invalid_make_int. (We could successfully generate
    a .int file for that test case *only if* we did not check it
    for errors :-)

tests/valid_seq/intermod_nested_module_bug2.m:
tests/valid_seq/intermod_nested_module_bug2.sub.m:
    Move two module imports from the parent to the child module,
    because only the child needs them, and any compiler with this diff
    will now complain about them being unused in the parent
    at interface generation time. Delete a third import, which was
    not used anywhere.
2021-11-20 23:49:19 +11:00
Julien Fischer
0cbbe0e9c1 Fix a typo.
tests/valid_seq/test_xmlreader.m:
    As above.
2020-11-15 21:24:15 +11:00
Zoltan Somogyi
21b0e35039 Update the style of the tests in valid_seq. 2020-11-15 08:02:47 +11:00
Peter Wang
88047bbb45 Delete Erlang from tests.
tests/general/float_test.exp3:
tests/general/float_test.m:
tests/general/read_dir_regression.exp4:
tests/general/read_dir_regression.m:
tests/hard_coded/remove_file.exp2:
tests/hard_coded/remove_file.m:
    Delete Erlang backend specific expected outputs.

tests/hard_coded/Mmakefile:
tests/hard_coded/erlang_deconstruct.exp:
tests/hard_coded/erlang_deconstruct.m:
tests/hard_coded/existential_list.exp:
tests/hard_coded/existential_list.m:
tests/valid/Mmakefile:
tests/valid/erl_ite_vars.m:
tests/valid/zf_erlang_bug.m:
    Delete erlang target specific tests.

tests/*:
    Delete Erlang foreign procs and foreign types.
2020-10-27 11:10:11 +11:00
Zoltan Somogyi
35656df2ef Fix test case failures by adding foreign_procs. 2020-08-09 20:30:54 +10:00
Zoltan Somogyi
6d79ac7802 Fix some anachronisms in tests/valid*.
tests/valid/Mmake.valid.common:
    Delete the RESERVE_TAG_PROGS make variable, since we have not supported
    reserved tags for a long time.

    Delete the NO_SPECIAL_PREDS_PROG make variable, since (despite its
    documentation) we do not actually specify --no-special-preds for
    the test cases listed in it.

tests/valid/Mmakefile:
    Conform to the changes above. Move the only test listed for
    NO_SPECIAL_PREDS_PROG to OTHER_PROGS.

tests/valid_seq/Mmakefile:
    Conform to the changes above.

tests/valid/unify_typeinfo_bug.m:
    Fix programming style.

tests/valid_seq/intermod_user_sharing.m:
    Delete a redundant import.
2020-07-14 00:51:50 +10:00
Zoltan Somogyi
1f45f91886 Make "mmake runtests" work again.
My commit afe2887882 broke the ability
to run the test suite outside of a bootcheck by executing "mmake runtests"
in the tests directory. This diff fixes that.

tests/Mmake.common:
    Don't define "TESTS_DIR = ..". While every single tests/*/Mmakefile
    defined it as such, I overlooked the fact that tests/Mmakefile itself
    defined it ".", referring to the same directory from a different starting
    point. Document this easily-overlooked fact.

    Rename the old runtests target, which after afe2887 runs the tests
    in a single directory, as runtests_dir, to leave the target name
    "runtests" itself free for tests/Mmakefile to use.

tests/Mmakefile:
    Define "TESTS_DIR = .", and add a target "runtests" which invokes
    "mmake runtests_dir" in each test directory.

tools/bootcheck:
    Invoke "mmake runtests_dir" instead of "mmake runtests" in each
    test directory.

    Initialize a variable just before it is used.

tests/*/Mmakefile:
    Add back the definition "TESTS_DIR = .."
2020-06-10 01:05:15 +10:00
Zoltan Somogyi
afe2887882 Remove stale references to test subdirs.
A long time ago, test directories such as hard_coded had subdirectories
such as hard_coded/typeclasses. These have since been flattened out
(e.g. hard_coded/typeclasses is now just typeclasses), but there were
still remnants of the old approach. This diff deletes those remnants.

tests/*/Mmakefile:
    Delete the TESTS_DIR and the SUBDIRS mmake variables; TESTS_DIR
    was always set to "..", and SUBDIRS to the empty string.

    Delete any references to the make variable NOT_WORKING, since
    it is never used.

tests/Mmake.common:
    Document that Mmakefiles in test directories don't have to set
    TESTS_DIR and SUBDIRS anymore. Fix the formatting of the documentation
    of the make variables they do still have to set.

    Delete the targets and actions for handling subdirectories of
    test directories, since there aren't any.

tests/Mmakefile:
    Simplify some code.
2020-04-14 11:23:12 +10:00
Zoltan Somogyi
cb517805a2 Delete an (irrelevant) unused import. 2019-08-07 21:17:18 +02:00
Zoltan Somogyi
10e7ababb0 Don't generate irrelevant warnings. 2019-08-07 21:16:16 +02:00
Zoltan Somogyi
4b2a4a88b5 Fix handling "int used, imp imported" modules when making interface files.
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.
2019-08-02 10:36:59 +02:00
Zoltan Somogyi
faa78b348e Fix a test case after Julien's recent change. 2017-03-15 09:58:21 +11:00
Julien Fischer
bcef4e5ea0 Do not run tests/valid_seq/test_xmlreader in non-C grades.
tests/valid_seq/Mmakefile:
    Do not runt he test_xmlreader test case in non-C grades, since
    it lacks the relevant foreign code definitions (and is a regression
    test for the LLDS code generator anyway.)
2016-06-23 11:13:18 +10:00
Julien Fischer
1d351be438 Avoid running some tests in decldebug grades.
Fix an error message.

tests/valid/Mmake.valid.common:
tests/valid/Mmakefile:
tests/valid_seq/Mmakefile:
     Don't run valid/bug50 and valid/bug50_full in decldebug grades,
     since they force the use of --trace deep.

compiler/handle_options.m:
   Quote the trace level when referring to it in an error message.

   Fix an incorrect option name in an error message.
2016-02-09 18:27:57 +11:00
Zoltan Somogyi
5649f36c80 Handle "use_module in interface, import_module in implementation".
If a module m1 imports module m2 using a use_module declaration in its
interface section but also imports it using an import_module declaration
in its implementation section, then references to entities defined in m2
in the interface of m1 must be module qualified, but similar references
in the implementation of m1 need NOT be module qualified.

The Mercury compiler has long had a bug that allowed entities imported
in the implementation of module m1 to be used in the interface of m1,
against the rules of the language. When I fixed that bug on 2015 nov 11,
the compiler became unable to properly process the situation described
in the paragraph above, because it still had another bug, which was that
it had a single setting for module qualification requirements: either it
was required *everywhere* in m1, or it was required *nowhere* in m1.
This diff fixes that bug (mantis bug 401) by allowing different requirements
in this respect in the interface of m1 versus its implementation.

It also changes the de-facto meaning of what exactly a use_module declaration
requires. The reference manual says only:

    Uses of entities imported using @code{use_module} declarations
    @emph{must} be explicitly module qualified.

This WAS unambiguous when it was written in june 1997, a few months before
submodules were added to the language. With a flat module system, there were
no nested module names, so either the module name was present, or it wasn't.
In the presence of nested modules, though, it IS ambiguous: HOW MUCH of
the module name must be present? The reference manual is silent on this.

At the moment, in the presence of a use_module for module ma.mb.mc,
a predicate p1 in ma.mb.mc may of course be referred to as ma.mb.mc.p1,
but may also be referred to as mb.mc.p1, or even just mc.p1. The specification
of mc is always required, but exactly WHICH of the previous module name
components are required depends on whether e.g. ma or ma.mb were themselves
imported via use_module or import_module declarations. The code implementing
the check (find_matches_in_permissions_map in module_qual.id_set.m) is itself
not too clear.

This diff changes the rules so that all references to anything imported
via a use_module declarations have to be fully qualified. This is stricter
than the existing rule, but it is MUCH simpler, and it better matches
the original intent of use_module declarations, which is the avoidance
of ALL POSSIBILITY of ambiguity.

NEWS:
doc/reference_manual.texi:
    Document this change to the language.

compiler/prog_item.m:
    Change the representation of sections in .int* files. Previously,
    we recorded whether the interface file that the section was from
    was read for an `import_module' or a `use_module' declaration.
    We now allow the recording of the fact that it had both declarations,
    a use_module in the interface and an import_module in the implementation.

compiler/modules.m:
    Treat modules that have both a `use_module' declaration in interface
    and an `import_module' declaration in the implementation as being of this
    new internal section kind.

    Add some infrastructure for debugging similar problems in the future.

compiler/module_qual.id_set.m:
    Change the permissions system. Instead of recording *independently*
    whether (a) an entity may be used in the interface and (b) whether
    references to it must be qualified, record *separately* whether
    (a) it may be used in the interface, and if so with what qualification
    requirements, and (b) what its qualification requirements are in the
    implementation. Unlike the old permission setup, the new one allows us
    to express the "use_module in interface, import_module in implementation"
    situation.

    Implement the change to the language, by requiring full module
    qualification of entities imported via use_module declarations.
    This allows us to use a single parameterized piece of code to handle
    both unqualified and qualified references, whereas before we used
    separate pieces of code for them.

    Change the way we handle errors in module qualification. Instead of
    looking only for precise matches only, and looking for the possible causes
    of errors only if we find either no matches or two or more matches, we now
    return the near-miss matches as well, the ones that we need to decide
    on what error message we want to generate. While this is slightly slower,
    it is *much* simpler, since it allows us to avoid duplicating the search
    code: once for precise matches only, once for no-match errors, and once
    for multiple-match errors.

compiler/module_qual.collect_mq_info.m:
    Set permissions for symbol access according to the new permissions system.
    Code that previously triggered the bug will use the new interface file
    section kind, and can now have its permissions record correctly.

compiler/module_qual.qual_errors.m:
    Use a single predicate to generate error messages for all situations
    in which there is not a single precise match for a module qualification.
    This allows us to diagnose multiple potential problems with a single
    lookup.

    Change the wording of an existing error message to avoid a possibly-untrue
    implication.

compiler/hlds_data.m:
    Rename a field of the type_defn type to better document its meaning.

compiler/make_hlds.m:
    Document the meaning of the need_qualifier field in sec_infos.

compiler/add_type.m:
compiler/make_hlds_separate_items.m:
compiler/module_qual.m:
compiler/pred_table.m:
compiler/parse_tree_out.m:
compiler/prog_item_stats.m:
    Conform to the above changes.

mdbcomp/sym_name.m:
    Add a utility predicate for use in looking for near-miss matches
    in module qualification.

    Make the documentation of a related predicate more precise.

tests/invalid/bad_instance.m:
tests/submodules/class.m:
tests/submodules/nested.m:
tests/submodules/nested3.m:
tests/submodules/parent.m:
    Make names fully module qualified where the language rules now require it.

tests/submodules/deeply_nested.m:
    Comment out a part of the test that tested the partially qualified names,
    since these are now not allowed.

tests/invalid/errors.err_exp:
    Expect a now-improved error message.

tests/invalid/test_nested.err_exp:
tests/invalid/transitive_import.err_exp:
tests/invalid/undef_type.err_exp:
    Expect a now less-likely-to-mislead error message.

tests/valid_seq/int_impl_imports.m:
tests/valid_seq/int_impl_imports_2.m:
    The test case for mantis bug 401.

tests/valid_seq/Mmakefile:
    Enable the new test case.
2016-01-11 23:05:39 +11:00
Julien Fischer
3dd02876a5 Delete the MLDS->IL backend.
compiler/mlds_to_il.m:
compiler/mlds_to_ilasm.m:
compiler/mlds_to_managed.m:
compiler/il_peephole.m:
compiler/ilasm.m:
compiler/ilds.m:
    Delete the modules making up the MLDS->IL code generator.

compiler/globals.m:
compiler/prog_data.m:
    Delete IL as a target and foreign language.

compiler/prog_io_pragma.m:
    Delete the max_stack_size/1 foreign proc attribute.  This was only
    ever required by the IL backend.

compiler/options.m
    Delete options used for the IL backend.

compiler/write_deps_file.m:
    Don't generate mmake targets for .il files etc.

compiler/*.m:
    Conform to the above changes.

compiler/notes/compiler_design.html
compiler/notes/work_in_progress.html
    Conform to the above changes.

library/*.m:
    Delete IL foreign_proc and foreign_export pragmas.

README.DotNet:
    Delete this file.

browser/Mmakefile:
compiler/Mmakefile:
deep_profiler/Mmakefile:
mdbcomp/Mmakefile:
mfilterjavac/Mmakefile:
profiler/Mmakefile:
runtime/Mmakefile:
slice/Mmakefile:
    Conform the above changes.

configure.ac:
    Don't check that IL is a supported foreign language when performing the
    up-to-date check.

    Delete the '--enable-dotnet-grades' option.

scripts/Mmake.vars.in:
    Delete variables used for the IL backend (and in on case by the Aditi
    backend).

scripts/Mercury.config.bootstrap.in:
scripts/Mercury.config.in:
scripts/Mmake.rules:
scripts/canonical_grade.sh-subr:
tools/bootcheck:
    Delete stuff related to the 'il' and 'ilc' grades.

doc/reference_manual.texi:
     Delete the documentation of the 'max_stack_size' option.

doc/user_guide.texi:
     Delete stuff related to the IL backend.

tests/hard_coded/csharp_test.{m,exp}:
tests/invalid/foreign_type_missing.{m,err_exp}:
tests/valid/csharp_hello.m:
	Delete these tests: they are no longer relevant.

tests/hard_coded/equality_pred_which_requires_boxing.m:
tests/hard_coded/foreign_import_module.m:
tests/hard_coded/foreign_import_module_2.m:
tests/hard_coded/foreign_type.m:
tests/hard_coded/foreign_type2.m:
tests/hard_coded/foreign_type3.m:
tests/hard_coded/intermod_foreign_type2.m:
tests/hard_coded/lp.m:
tests/hard_coded/user_compare.m:
tests/invalid/foreign_type_2.m:
tests/invalid/foreign_type_missing.{m,err_exp}:
tests/invalid/foreign_type_visibility.m:
tests/invalid/illtyped_compare.{m,err_exp}:
tests/submodules/external_unification_pred.m
tests/valid/big_foreign_type.m
tests/valid/solver_type_bug.m
tests/valid_seq/foreign_type_spec.m
tests/valid_seq/intermod_impure2.m
    Delete IL foreign_procs where necessary.

tests/hard_coded/Mmakefile
tests/invalid/Mercury.options
tests/invalid/Mmakefile
tests/submodules/Mmakefile
tests/valid/Mercury.options
tests/valid/Mmake.valid.common
tests/valid/Mmakefile
tests/valid_seq/Mmakefile
tests/valid_seq/Mercury.options
    Conform to the above changes.
2015-09-21 11:34:46 +10:00
Zoltan Somogyi
057fe9ecd0 Clean up after --grade il tests. 2015-09-10 08:05:12 +10:00
Zoltan Somogyi
e0cdfc2fe2 Make the tests really work in parallel.
There was a bug that prevented the tests in each directory from being run
in parallel, even when the mmake was invoked with e.g. -j4. The bug
was the absence of a '+' on an action that invoked tests/run_one_test.
Without that +, the make process inside the "mmake -j4 runtests_local"
command issued by bootcheck screwed up its connection with the recursive
make invoked by run_one_test, and apparently decided to stop using
parallelism. It was telling us this all this time but its messages,
which looked like this:

    make[2]: warning: -jN forced in submake: disabling jobserver mode.

were lost in the sea of other bootcheck output until my recent change
to run_one_test.

A single-character change fixes the bug; the rest of this big change is
dealing with the consequences of fixing the bug. Many test cases in
the hard_coded and valid directories contain nested modules, which
need to be compiled sequentially.

tests/Mmake.common:
    Fix the bug.

    Delete the duplicate "ALL TESTS SUCCEEDED" message from the runtests
    target, since the runtests_local target already prints a message
    to that effect. Make this message more emphatic.

tests/run_one_test:
    Make the output a bit easier to understand.

tests/hard_coded/*.{m,exp}:
tests/submodules/*.{m,exp}:
    Move the source files and expected output files of the test cases that
    use nested modules from hard_coded to submodules, since most of the tests
    in the hard_coded can be done in parallel, while the ones in submodules
    are already done in sequence.

tests/hard_coded/Mmakefile:
tests/hard_coded/Mercury.options:
tests/submodules/Mmakefile:
tests/submodules/Mercury.options:
    Move the Mmakefile and Mercury.options entries of the moved test cases
    from hard_coded to submodules.

tests/valid_seq:
    A new test directory, to hold the test cases originally in tests/valid
    that contain nested modules. Moving these to a new directory, which
    forces -j1, allows us to execute the remaining ones in parallel.

tests/valid/*.m:
tests/valid_seq/*.m:
    Move the source files of the test cases that use nested modules
    from valid to valid_seq.

    In a few cases, clean up the test cases a bit.

tests/valid/Mmakefile:
tests/valid/Mercury.options:
tests/valid_seq/Mmakefile:
tests/valid_seq/Mercury.options:
tests/valid/Mmake.valid.common:
    Add valid_seq/Mmakefile to list the test cases now in valid_seq,
    and add valid_seq/Mercury.options to hold their option values.
    Delete the entries of those tests from valid/Mmakefile, and their option
    values from valid/Mercury.options. Unlike valid/Mmakefile,
    valid_seq/Mmakefile forces -j1.

    To avoid unnecessary duplication between the two Makefiles, put
    all the rules that both need into valid/Mmake.valid.common, and
    include this in both Mmakefiles.

tests/string_format/Mmakefile:
    Force -j1, since these tests share a library module.

tests/Mmakefile:
    List the new valid_seq directory among the others.

tests/bootcheck:
    Execute the tests in the new valid_seq directory as well as the others.

    Record when the execution of the test suite is started.

    Comment out invocations of set -x, since they add no useful information
    in the vast majority of cases. The comment sign can be removed if and
    when the information *would* be useful.

    Don't try to copy a nonexistent file. (The error message about this
    was also lost in the noise.)
2015-08-26 01:01:54 +10:00