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.
The two main changes in this commit are:
(1) Use the error_util library's decl/1 and pramga_decl/1 format components in more
places.
(2) Quote type variables that appear in error messages.
compiler/error_util.m:
Add a version of list_to_pieces/1 that places each of the strings in
the input list in single quotes.
compiler/prog_io_type_defn.m:
Quote type variables names in error messages.
compiler/add_class.m:
compiler/add_pragma.m:
compiler/add_pred.m:
compiler/check_typeclass.m:
compiler/make_hlds_error.m:
compiler/post_typecheck.m:
compiler/prog_io.m:
Use the error_util library's decl/1 and pragma_decl/1 format components
in more places.
compiler/mode_errors.m:
Quote program variables and insts in some error messages.
compiler/post_term_analysis.m:
Format a type ctor and arity in an error message properly.
tests/invalid/*.err_exp:
tests/warnings/*.exp:
Conform to the above changes.
Estimated hours taken: 12
Branches: main
Modify check_typeclass.m to gather up all error messages, and print them all
at once after sorting.
Modify the determinism analysis pass to generate error_specs directly, instead
of generating context_det_msgs and converting those to error_specs later.
Separate the simplify pass's mechanism for generating error messages from
the determinism pass.
compiler/check_typeclass.m:
Return all error messages instead of printing them when generated.
Keep the error messages outside the instance_method_info structure,
and give the fields of the structure names.
compiler/det_analysis.m:
Generate error specs directly.
compiler/det_report.m:
Delete the context_det_msg data type and the predicates that operated
on it, since they are no longer needed. The code that used to convert a
context_det_msg into an error_spec is now dispersed to the sites that
generate the error report in the first place. These sites are mostly
in det_analysis.m and simplify.m, with a few in other modules
(e.g. common.m and format_call.m). Export some auxiliary functions
that the these sites now need.
compiler/simplify.m:
Generate error_specs directly, instead of through context_det_msgs,
and return them to the caller for printing.
compiler/common.m:
compiler/format_call.m:
Conform to the change to det_report.m.
compiler/unused_import.m:
Return all error messages instead of printing them when generated.
compiler/mercury_compile.m:
Print the error message batches returned by the modified passes.
Use the version of globals in module_infos in preference to the one
in the I/O state, since we would like to phase out the latter.
Don't explicitly sort error_specs, since write_error_specs will do
it anyway.
compiler/error_util.m:
Separate the error messages of the simplify pass from those of
determinism analysis.
Provide a standard way to format type constructor names.
Require the calls to provide the globals when printing error_specs.
This is to allow callers to provide the globals from a module_info,
instead of the one in the I/O state.
compiler/passes_aux.m:
Provide support for passes that have lists of error_specs threaded
through them, as simplify now does.
Rename some predicates to avoid some ambiguities.
compiler/deforest.m:
compiler/pd_util.m:
compiler/unify_proc.m:
compiler/unused_args.m:
Conform to the change to the interface of determinism analysis.
compiler/inlining.m:
Do not thread the I/O state through this module.
compiler/make.module_dep_file.m:
compiler/make_hlds_passes.m:
compiler/ml_tailcall.m:
compiler/mode_errors.m:
compiler/modes.m:
compiler/modules.m:
compiler/stratify.m:
compiler/table_gen.m:
Conform to the change in error_util.
compiler/prog_data.m:
Rename some function symbols to avoid some ambiguities.
compiler/add_class.m:
compiler/base_typeclass_info.m:
compiler/hlds_out.m:
compiler/intermod.m:
compiler/module_qual.m:
compiler/prog_io_typeclass.m:
compiler/recompilation.check.m:
compiler/recompilation.usage.m:
compiler/recompilation.version.m:
compiler/type_class_info.m:
Conform to the change in prog_data.m.
tests/invalid/*err_exp:
Update the expected output files to conform to the changes above.
This mosly involves expecting sorted messages without duplicates.
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.
Estimated hours taken: 1.5
Branches: main
Do not display the `For more information try recompiling with `-E'' prompt
unless we really mean it, i.e. there is actually more information available.
XXX This change is incomplete for the mode_errors module because that
module requires more substantial changes to make this work - I'll do
that as a separate diff.
compiler/globals.m
Add a new global (and access predicates) that keeps track of whether
we have any verbose error information that could be displayed if we
recompiled with `-E'.
compiler/mercury_compile.m
Check the new global flag before prompting the user to recompile with
`-E'.
compiler/mode_errors.m
Add an XXX comment about needing to respect the extra error info flag
properly.
compiler/accumulator.m
compiler/add_clause.m
compiler/add_pred.m
compiler/add_type.m
compiler/assertion.m
compiler/check_typeclass.m
compiler/det_report.m
compiler/magic_util.m
compiler/make_hlds_error.m
compiler/modes.m
compiler/module_qual.m
compiler/modules.m
compiler/post_typecheck.m
compiler/purity.m
compiler/stratify.m
compiler/typecheck_errors.m
Set the new global flag when we come across an error
for which we have a verbose error message.
tests/recompilation/*:
tests/invalid/*:
Update expected error files.
Estimated hours taken: 2
Branches: main, release-0.12
Only allow existential constraints to constrain existentially quantified
type variables. Likewise only allow universal constraints to constrain
universally quantified type variables.
We previously didn't check these conditions, and in fact the reference
manual allowed otherwise. However, the implementation did not support
existential constraints on universally quantified type variables, and
will not do so for the foreseeable future. The implementation does support
universal constraints on existentially quantified variables, however these
are not useful since no caller will ever be able to satisfy the constraints.
compiler/check_typeclass.m:
Check these conditions as part of typeclass checking.
Also return a bool from the recently added check for concrete
instances, indicating whether errors were found or not.
compiler/error_util.m:
compiler/hlds_error_util.m:
Add a couple of utility functions for constructing error messages.
compiler/mercury_compile.m:
Stop compilation after checking typeclasses if errors were encountered.
If the above conditions are not met then typechecking may abort.
doc/reference_manual.texi:
Document the condition on typeclass constraints.
tests/invalid/Mmakefile:
tests/invalid/quant_constraint_1.err_exp:
tests/invalid/quant_constraint_1.m:
tests/invalid/quant_constraint_2.err_exp:
tests/invalid/quant_constraint_2.m:
Test cases for the new error messages.
tests/invalid/unbound_type_vars.err_exp:
Update this test case.