mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-18 19:03:45 +00:00
083d376e6598628362ee91c2da170febd83590f4
3 Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
fdd141bf77 |
Clean up the tests in the other test directories.
tests/invalid/*.{m,err_exp}:
tests/misc_tests/*.m:
tests/mmc_make/*.m:
tests/par_conj/*.m:
tests/purity/*.m:
tests/stm/*.m:
tests/string_format/*.m:
tests/structure_reuse/*.m:
tests/submodules/*.m:
tests/tabling/*.m:
tests/term/*.m:
tests/trailing/*.m:
tests/typeclasses/*.m:
tests/valid/*.m:
tests/warnings/*.{m,exp}:
Make these tests use four-space indentation, and ensure that
each module is imported on its own line. (I intend to use the latter
to figure out which subdirectories' tests can be executed in parallel.)
These changes usually move code to different lines. For the tests
that check compiler error messages, expect the new line numbers.
browser/cterm.m:
browser/tree234_cc.m:
Import only one module per line.
tests/hard_coded/boyer.m:
Fix something I missed.
|
||
|
|
5eee81204e |
A big step towards cleaning up the way we handle errors.
Estimated hours taken: 28 Branches: main A big step towards cleaning up the way we handle errors. The main changes are - the provision, in error_util.m, of a mechanism for completely specifying everything to do with a single error in one data structure, - the conversion of typecheck_errors.m from using io.write_string to using this new capability, - the conversion of mode_errors.m and det_report.m from using write_error_pieces to using this new capability, and - consistently using the quoting style `symname'/N instead of `symname/N' in error_util and hlds_error_util (previously, error_util used the former but hlds_error_util used the latter). This diff sets up later diffs which will collect all error specifications in a central place and print them all at once, in order. compiler/error_util.m: The new type error_spec, which completely specifies an error. An error_spec may have multiple components with different contexts and may have parts which are printed only under certain conditions, e.g. a given option being set. Each error_spec has a severity and also records which phase found the error. The new predicate write_error_spec takes care of updates of the exit status for errors and (if --halt-at-warn is set) for warnings. It also takes care of setting the flag that calls for the reminder about -E at the end. This diff also makes it simpler to use the ability to print arbitrary output. It adds the ability to include integers in messages directly, and the ability to create blank lines. It renames some function symbols to avoid ambiguities. Move a predicate that only used by typecheck_errors.m to that file. compiler/hlds_error_util.m: Switch to the `symname'/N quoting style for describing predicates and procedures. compiler/prog_util.m: Switch to the `symname'/N quoting style for describing sym_name_and_arity. compiler/hlds_module.m: Provide a predicate to increment the number of errors not by one, but by the number of errors printed by write_error_spec. Fix some documentation rot. compiler/typecheck_errors.m: Use write_error_spec instead of io.write_strings to print error messages. In several cases, improve the formatting of the messages printed. Mark a number of places where we don't (yet) update the number of errors in the module_info correctly. Rename the checkpoint predicate to avoid potential ambiguity with similar predicates in e.g. mode_info. compiler/typecheck_info.m: Group the code for writing stuff out together in one bunch. For each such predicate, create another that returns a list of format components instead of doing I/O directly. compiler/typecheck.m: Move the code for writing inference messages here from typecheck_errors.m, since these messages aren't errors. compiler/mode_errors.m: compiler/det_report.m: Use write_error_spec instead of write_error_pieces. In the case of mode_errors.m, this means we now get correct the set of circumstances in which we set the flag that calls for the reminder about -E. compiler/add_pragma.m: compiler/add_type.m: Convert some code that used to use write_error_pieces to print error messages to use write_error_spec instead. compiler/assertion.m: compiler/hlds_pred.m: compiler/post_typecheck.m: Assertion.m used to contain some code to check for assertions in the interface that mention predicates that are not exported. Move most of this code to post_typecheck.m (which is where this code used to be called from). One small part, which is a test for a particular property of import_statuses, is moved to hlds_pred.m to be with all the other similar tests of import_statuses. compiler/prog_util.m: Change unqualify_name from a predicate to a function. compiler/pred_table.m: compiler/hlds_out.m: Avoid some ambiguities by adding a suffix to the names of some predicates. compiler/*.m: Conform to the changes above. library/list.m: Add a function that was previously present (with different names) in two compiler modules. tests/hard_coded/allow_stubs.exp: Update the format of the expected exception. tests/invalid/errors2.err_exp2: Remove this file. As far as I can tell, it was never the correct expected output on the main branch. (It originated on the alias branch way back in the mists of time.) tests/invalid/*.err_exp: tests/invalid/purity/*.err_exp: tests/warnings/*.exp: Update the format of the expected error messages. tests/recompilation/*.err_exp.2: Update the format of the expected messages about what was modified. |
||
|
|
b9ca44672b |
Fix the bugs were exposed by my pre-dummy-type-diff cleanup of polymorphism.m.
Estimated hours taken: 24
Branches: main
Fix the bugs were exposed by my pre-dummy-type-diff cleanup of polymorphism.m.
This diff deleted a "semidet_fail" in the predicate that tested whether a
foreign_proc used a variable, making the test a real test, not a dummy.
The main bugs were in unused_args.m, polymorphism.m and ml_unify_gen.m.
compiler/unused_args.m:
Fix the mismatch between the analysis and fixup passes' treatment of
foreign_procs. The analysis pass says that variables representing
unnamed foreign_proc arguments are unused, and therefore the code
generating them can be optimized away, but the fixup pass used to leave
those arguments unchanged. This is usually fine, but there was a
problem if a variable had two or more such conjoined consumers but no
other consumers. It then had its generator optimized away, but the
variable was left in the nonlocal set of each consumer, which meant
that the code generator aborted when trying to save the value of the
variable after the first consumer.
The fix is to rename unnamed foreign proc args, ensuring that they are
local to the foreign_proc they appear in. The code generators can
already handle such arguments.
compiler/typecheck.m:
Detect foreign_procs that are supposed to bind type_info variables,
but don't, and generate error messages for them. This is now necessary,
since if we accept such predicates, unused_args.m will now rename apart
the unused type_info argument, and the code generator will abort
due to the type_info missing its generator.
compiler/typecheck_errors.m:
Add a predicate for reporting the error.
compiler/goal_util.m:
Add a utility predicate and export some previously internal predicates
for use by unused_args.m.
Delete redundant module prefixes on predicate names to avoid having to
split long lines.
compiler/polymorphism.m:
Ensure that all arguments of import foreign_procs are considered used,
since our contract with foreign language code prevents us from
optimizing them away.
Redefine a predicate using the new utility predicate in goal_util.m.
compiler/pragma_c_gen.m:
Ensure that all arguments of import foreign_procs are considered used,
since our contract with foreign language code prevents us from
optimizing them away. This is a belt-and-suspenders fix: the change to
polymorphism.m should be sufficient to ensure this objective by itself.
compiler/ml_unify_gen.m:
The mark_static_terms pass was assuming that if X is a static term,
then after the assignment unification Y = X Y is also a static term.
However, when processing such assignments, the code generator here
neglected to copy over the part of the X's state that says what static
term it is to become part of Y's state. This diff fixes that neglect.
compiler/ml_code_util.m:
We used to identify MLDS variables holding static terms by a sequence
number, and then create a name from the number by tacking on the name
of the HLDS variable referring to it at each reference. This worked
because each static term was referred to by only one HLDS variable;
but after the diff to ml_unify_gen, this is no longer the case.
We therefore now construct the MLDS variable's name when the static
term is created, and use that name as the translation of all the HLDS
variables referring to that static term.
compiler/add_pragma.m:
Minor cleanup.
library/rtti_implementation.m:
library/store.m:
In some predicates that don't define type_infos for existentially typed
arguments, mention the type_info that *should* be defined there in
comments to avoid the error now generated by typecheck.m.
browser/Mercury.options:
deep_profiler/Mercury.options:
Undo the workaround for the fixed bug.
tests/existential_type_classes.m:
In predicates that don't define type_infos for existentially typed
arguments, mention the type_info that *should* be defined there in
comments to avoid the error now generated by typecheck.m.
tests/existential_type_classes.exp:
Conform to the changed line numbers in existential_type_classes.m.
tests/invalid/exist_foreign_error.{m,exp}:
New test case for the error now detected by typecheck.m.
tests/invalid/Mmakefile:
Enable the new test case.
|