compiler/mode_errors.m:
Use color more sparingly, to preserve the impact of when we *do* use it.
Improve the wording of some diagnostics. In one case, include
more information in a diagnostic.
Add some XXXs about possible further improvements.
compiler/make_hlds_warn.m:
Use color more sparingly, to preserve the impact of when we *do* use it.
compiler/error_spec.m:
Add two utility functions for use by new code in mode_errors.m.
compiler/modecheck_call.m:
Supply the extra detail now expected by mode_errors.m.
tests/invalid/any_mode.err_exp:
tests/invalid/any_passed_as_ground.err_exp:
tests/invalid/any_should_not_match_bound.err_exp:
tests/invalid/any_to_ground_in_ite_cond.err_exp:
tests/invalid/any_to_ground_in_ite_cond_nomax.err_exp:
tests/invalid/anys_in_negated_contexts.err_exp:
tests/invalid/bad_sv_unify_msg.err_exp:
tests/invalid/bind_in_negated.err_exp:
tests/invalid/bind_var_errors.err_exp:
tests/invalid/bug197.err_exp:
tests/invalid/bug278.err_exp:
tests/invalid/bug487.err_exp:
tests/invalid/char_inst.err_exp:
tests/invalid/coerce_clobbered.err_exp:
tests/invalid/coerce_disambig.err_exp:
tests/invalid/coerce_instvar.err_exp:
tests/invalid/coerce_int.err_exp:
tests/invalid/coerce_mode_error.err_exp:
tests/invalid/coerce_mode_error2.err_exp:
tests/invalid/coerce_recursive_inst.err_exp:
tests/invalid/coerce_recursive_type.err_exp:
tests/invalid/constrained_poly_insts2.err_exp:
tests/invalid/currying_multimode_func.err_exp:
tests/invalid/dcg_context.err_exp:
tests/invalid/default_ho_inst_1.err_exp:
tests/invalid/default_ho_inst_2.err_exp:
tests/invalid/field_syntax_error.err_exp:
tests/invalid/freefree.err_exp:
tests/invalid/functor_ho_inst_bad_1.err_exp:
tests/invalid/functor_ho_inst_bad_2.err_exp:
tests/invalid/functor_ho_inst_bad_3.err_exp:
tests/invalid/ho_any_inst.err_exp:
tests/invalid/ho_default_func_1.err_exp:
tests/invalid/ho_default_func_2.err_exp:
tests/invalid/ho_default_func_3.err_exp:
tests/invalid/ho_type_mode_bug.err_exp:
tests/invalid/ho_unique_error.err_exp:
tests/invalid/invalid_integral_call_inst.err_exp:
tests/invalid/io_in_ite_cond.err_exp:
tests/invalid/merge_inst_error.err_exp:
tests/invalid/mode_inf.err_exp:
tests/invalid/modes_erroneous.err_exp:
tests/invalid/mostly_uniq1.err_exp:
tests/invalid/mostly_uniq2.err_exp:
tests/invalid/multimode_addr_problems.err_exp:
tests/invalid/multimode_dcg.err_exp:
tests/invalid/partial_implied_mode.err_exp:
tests/invalid/polymorphic_unification.err_exp:
tests/invalid/state_vars_test_1.err_exp:
tests/invalid/state_vars_test_2.err_exp:
tests/invalid/state_vars_test_5.err_exp:
tests/invalid/try_detism.err_exp:
tests/invalid/unify_mode_error.err_exp:
tests/invalid/uniq_modes.err_exp:
tests/invalid/uniq_neg.err_exp:
tests/invalid_nodepend/errors_1.err_exp:
tests/invalid_nodepend/errors_2.err_exp:
tests/invalid_nodepend/errors_3.err_exp:
tests/invalid_nodepend/occurs.err_exp:
tests/invalid_purity/impure_func_t5_fixed.err_exp:
tests/invalid_purity/purity.err_exp:
tests/warnings/double_underscore.err_exp:
tests/warnings/foreign_singleton.err_exp:
tests/warnings/missing_singleton_warning.err_exp:
tests/warnings/pragma_source_file.err_exp:
tests/warnings/singleton_test.err_exp:
tests/warnings/singleton_test_state_var.err_exp:
tests/warnings/unknown_warning.err_exp:
Expect updated diagnostics.
compiler/mode_errors.m:
Use color to emphasize the subject variables and terms of mode errors.
Use color to emphasize disagreements as possible causes
in a few more places.
Require reporters of the "no matching mode" error to specify
what the match was against. This is to allow us to generate
better diagnostics. Note the things that should still be improved.
Use the names of numbers (as in two, three etc) instead of their numeral
versions.
Improve the wording and/or the punctuation of some error messages.
compiler/inst_mode_type_prop.m:
Use the names of numbers (as in two, three etc) instead of their numeral
versions.
compiler/error_spec.m:
compiler/write_error_spec.m:
Move two formerly private utility functions of write_error_spec.m
to error_spec.m, and export them. One of them is now used in
the modules above.
compiler/modecheck_call.m:
compiler/modecheck_goal.m:
compiler/modecheck_unify.m:
compiler/modecheck_util.m:
compiler/unique_modes.m:
Pass around info about "what the match was against" for the change
in mode_errors.m descrived above.
compiler/hlds_out_util.m:
Improve variable name.
compiler/hlds_module.m:
Add an XXX.
tests/invalid/any_mode.err_exp:
tests/invalid/any_passed_as_ground.err_exp:
tests/invalid/any_should_not_match_bound.err_exp:
tests/invalid/any_to_ground_in_ite_cond.err_exp:
tests/invalid/any_to_ground_in_ite_cond_nomax.err_exp:
tests/invalid/anys_in_negated_contexts.err_exp:
tests/invalid/bad_sv_unify_msg.err_exp:
tests/invalid/bind_in_negated.err_exp:
tests/invalid/bind_var_errors.err_exp:
tests/invalid/bug117.err_exp:
tests/invalid/bug191.err_exp:
tests/invalid/bug278.err_exp:
tests/invalid/bug415.err_exp:
tests/invalid/bug487.err_exp:
tests/invalid/char_inst.err_exp:
tests/invalid/coerce_clobbered.err_exp:
tests/invalid/coerce_disambig.err_exp:
tests/invalid/coerce_implied_mode.err_exp:
tests/invalid/coerce_instvar.err_exp:
tests/invalid/coerce_int.err_exp:
tests/invalid/coerce_mode_error.err_exp:
tests/invalid/coerce_mode_error2.err_exp:
tests/invalid/coerce_recursive_inst.err_exp:
tests/invalid/coerce_recursive_type.err_exp:
tests/invalid/coerce_uniq.err_exp:
tests/invalid/constrained_poly_insts2.err_exp:
tests/invalid/currying_multimode_func.err_exp:
tests/invalid/dcg_context.err_exp:
tests/invalid/default_ho_inst.err_exp:
tests/invalid/default_ho_inst_2.err_exp:
tests/invalid/freefree.err_exp:
tests/invalid/functor_ho_inst_bad.err_exp:
tests/invalid/functor_ho_inst_bad_2.err_exp:
tests/invalid/functor_ho_inst_bad_3.err_exp:
tests/invalid/ho_any_inst.err_exp:
tests/invalid/ho_default_func_1.err_exp:
tests/invalid/ho_default_func_2.err_exp:
tests/invalid/ho_default_func_3.err_exp:
tests/invalid/ho_default_func_4.err_exp:
tests/invalid/ho_type_mode_bug.err_exp:
tests/invalid/ho_unique_error.err_exp:
tests/invalid/html.err_exp:
tests/invalid/inst_matches_final_bug.err_exp:
tests/invalid/invalid_integral_call_inst.err_exp:
tests/invalid/io_in_ite_cond.err_exp:
tests/invalid/merge_ground_any.err_exp:
tests/invalid/merge_inst_error.err_exp:
tests/invalid/mode_error_arg_number.err_exp:
tests/invalid/mode_inf.err_exp:
tests/invalid/modes_erroneous.err_exp:
tests/invalid/mostly_uniq1.err_exp:
tests/invalid/mostly_uniq2.err_exp:
tests/invalid/multimode_dcg.err_exp:
tests/invalid/no_ho_inst.err_exp:
tests/invalid/partial_implied_mode.err_exp:
tests/invalid/polymorphic_unification.err_exp:
tests/invalid/state_vars_test1.err_exp:
tests/invalid/state_vars_test5.err_exp:
tests/invalid/try_detism.err_exp:
tests/invalid/unify_mode_error.err_exp:
tests/invalid/uniq_modes.err_exp:
tests/invalid/uniq_neg.err_exp:
tests/invalid_nodepend/constrained_poly_insts.err_exp:
tests/invalid_nodepend/occurs.err_exp:
tests/invalid_purity/impure_func_t5_fixed.err_exp:
tests/invalid_purity/purity.err_exp:
tests/warnings/simple_code.err_exp:
tests/warnings/unify_f_g.err_exp:
Expect the updated versions of diagnostics.
compiler/mode_errors.m:
Don't color the "or" between two colored insts.
Put quotes a variable name. Reword the error message this occurs in
to avoid using a possessive form of the variable name, to avoid
two right quote characters in a row.
tests/invalid/no_ho_inst.err_exp:
tests/invalid/polymorphic_unification.err_exp:
Expect the updated messages.
compiler/write_error_spec.m:
Redesign the code we use to decide what text goes onto each line.
The new design rests on these two new principles:
- Representing the current word separately from the words before it
on the line. This allows us to merge together an arbitrary number
of prefixes, a plain word, and an arbitrary number of suffixes
without the two additional passes that the old algorithm used
to accomplish the same goal.
- Representing the spaces between words *explicitly*. Together with
the previous principle, this allows us to do case analyses of the
possible configurations of text, spaces and color changes with
significantly simpler code than was possible with the previous design.
The new code is longer, but
- it is easier to see both that it does the right thing in each
of these situations, including interactions between prefixes and
suffixes on the one hand and color changes on the other, and
- it is easier to check that all possible combinations of the
relevant circumstances have code to handle them.
compiler/typecheck_error_undef.m:
Use the new capability by using color in arity mismatch reports,
which have the form of "(4, should be 2, 3 or 5)", where the numbers,
which are surrounded by two parentheses which are respectively
a prefix and a suffix, are colored.
compiler/error_spec.m:
Exclude from the list of pieces to be colored not just any final
subsequence of newline pieces, but any initial subsequence of newlines
as well. This avoids the output having lines which end in two consecutive
color changes with nothing between them: the first of which switches
to a color, and the second of which resets the current color to neutral.
library/cord.m:
library/list.m:
library/one_or_more.m:
library/ra_list.m:
Add a predicate named is_non_empty, which does what its name says,
to each of these modules. In cord.m, this is new functionality,
which is now used by write_error_spec.m. In the other modules,
this new predicate is a synonym for the existing predicate
is_not_empty. These modules were in a minority; all other modules
that had a predicate to test for nonemptyness named it is_noN_empty,
not is_noT_empty.
NEWS.md:
Announce the new is_non_empty predicates.
tests/invalid/constructor_warning.err_exp:
tests/invalid/getopt_io_old.err_exp:
tests/invalid/invalid_event.err_exp:
tests/invalid/no_method.err_exp:
tests/invalid/types2.err_exp:
tests/invalid/wrong_arity_function.err_exp:
Expect the new colored output from typecheck_error_undef.m,
without the extra spaces around parentheses that the version
of write_error_spec.m before this diff would have put around them.
tests/invalid/bug117.err_exp:
tests/invalid/bug191.err_exp:
tests/invalid/bug415.err_exp:
tests/invalid/char_inst.err_exp:
tests/invalid/coerce_int.err_exp:
tests/invalid/coerce_mode_error.err_exp:
tests/invalid/coerce_recursive_type.err_exp:
tests/invalid/constrained_poly_insts2.err_exp:
tests/invalid/default_ho_inst.err_exp:
tests/invalid/det_errors.err_exp:
tests/invalid/det_errors_and_io.err_exp:
tests/invalid/functor_ho_inst_bad.err_exp:
tests/invalid/ho_type_mode_bug.err_exp:
tests/invalid/html.err_exp:
tests/invalid/merge_ground_any.err_exp:
tests/invalid/mode_error_arg_number.err_exp:
tests/invalid/partial_implied_mode.err_exp:
tests/invalid/polymorphic_unification.err_exp:
tests/invalid/require_scopes.err_exp:
tests/invalid/type_prop_into_inst.err_exp:
Expect the absence of switches to a color followed IMMEDIATELY
by a color reset, thanks to the update of error_spec.m.
compiler/mode_errors.m:
Add color to diagnostics about mode errors where appropriate.
compiler/error_spec.m:
Fix an issue raised by the changes to mode_errors.m, which was that
having a colored span end in two or more newline pieces led to
an unnecessary seemingly blank line at the end. (The line actually
contained escape sequences to first set a color, and to then reset colors,
but none of that was visible.) The fix is to always add color resets
*before* any final sequence of newline pieces in the span being colored.
compiler/error_msg_inst.m:
Add a note to a comment.
tests/invalid/any_mode.err_exp:
tests/invalid/any_should_not_match_bound.err_exp:
tests/invalid/any_to_ground_in_ite_cond.err_exp:
tests/invalid/any_to_ground_in_ite_cond_nomax.err_exp:
tests/invalid/anys_in_negated_contexts.err_exp:
tests/invalid/bad_sv_unify_msg.err_exp:
tests/invalid/bind_in_negated.err_exp:
tests/invalid/bind_var_errors.err_exp:
tests/invalid/bug117.err_exp:
tests/invalid/bug191.err_exp:
tests/invalid/bug278.err_exp:
tests/invalid/bug415.err_exp:
tests/invalid/bug487.err_exp:
tests/invalid/char_inst.err_exp:
tests/invalid/coerce_clobbered.err_exp:
tests/invalid/coerce_disambig.err_exp:
tests/invalid/coerce_implied_mode.err_exp:
tests/invalid/coerce_instvar.err_exp:
tests/invalid/coerce_int.err_exp:
tests/invalid/coerce_mode_error.err_exp:
tests/invalid/coerce_mode_error2.err_exp:
tests/invalid/coerce_recursive_inst.err_exp:
tests/invalid/coerce_recursive_type.err_exp:
tests/invalid/coerce_uniq.err_exp:
tests/invalid/constrained_poly_insts2.err_exp:
tests/invalid/currying_multimode_func.err_exp:
tests/invalid/dcg_context.err_exp:
tests/invalid/default_ho_inst.err_exp:
tests/invalid/functor_ho_inst_bad.err_exp:
tests/invalid/functor_ho_inst_bad_2.err_exp:
tests/invalid/functor_ho_inst_bad_3.err_exp:
tests/invalid/ho_any_inst.err_exp:
tests/invalid/ho_default_func_2.err_exp:
tests/invalid/ho_type_mode_bug.err_exp:
tests/invalid/ho_unique_error.err_exp:
tests/invalid/html.err_exp:
tests/invalid/inst_matches_final_bug.err_exp:
tests/invalid/invalid_integral_call_inst.err_exp:
tests/invalid/io_in_ite_cond.err_exp:
tests/invalid/merge_ground_any.err_exp:
tests/invalid/merge_inst_error.err_exp:
tests/invalid/mode_error_arg_number.err_exp:
tests/invalid/modes_erroneous.err_exp:
tests/invalid/mostly_uniq1.err_exp:
tests/invalid/mostly_uniq2.err_exp:
tests/invalid/multimode_dcg.err_exp:
tests/invalid/no_ho_inst.err_exp:
tests/invalid/partial_implied_mode.err_exp:
tests/invalid/polymorphic_unification.err_exp:
tests/invalid/qualified_cons_id2.err_exp:
tests/invalid/state_vars_test5.err_exp:
tests/invalid/unify_mode_error.err_exp:
tests/invalid/uniq_modes.err_exp:
tests/invalid/uniq_neg.err_exp:
tests/invalid_nodepend/constrained_poly_insts.err_exp:
tests/invalid_nodepend/occurs.err_exp:
tests/invalid_purity/impure_func_t5_fixed.err_exp:
tests/invalid_purity/purity.err_exp:
tests/warnings/simple_code.exp:
tests/warnings/unify_f_g.exp:
Expect colors in these diagnostics.
compiler/parse_tree_out_sym_name.m:
As above.
tests/invalid/*.err_exp:
tests/term/*.trans_opt_exp:
tests/warnings/test_tscp.exp:
Update these files to expect the *absence* of unnecessary parentheses
around sym_names.
tests/term/foreign_valid.m:
Export some pragmas to avoid warnings that are irrelevant to the test.
compiler/error_msg_inst.m:
Fix a bug that caused the suffix that all paths in two predicates
were supposed to add at the logical end of the constructed pieces
(though it could be followed by some punctuation) to *not* be added
to the constructed pieces on some paths. Since with our current approach,
the suffix for one inst in a list of insts can be the description
of *all the insts following it in the list*, this bug could delete
not just punctuation, but entire insts from the output. This did actually
happen for the invalid/html text case below.
Fix a problem that could cause each inst in a list of insts
to be indented one more level than the previous inst, which can be
very confusing.
Delete the comma from "instname, which expands to ...". When this output
occurs in an argument list, the presence of the comma can make it
harder to recognize where one argument ends and the next argument begins.
Factor out some common code.
Add an XXX noting a problem.
Fix documentation.
compiler/parse_tree_out_inst.m:
Provide two functions for use by error_msg_inst.m.
compiler/prog_mode.m:
Fix a comment.
tests/invalid/html.m:
Fix the description of the problem we are testing for.
tests/invalid/html.err_exp:
Expect the fix for the "omitted insts" bug above.
tests/invalid/bug117.err_exp:
tests/invalid/bug191.err_exp:
tests/invalid/bug415.err_exp:
tests/invalid/char_inst.err_exp:
tests/invalid/coerce_int.err_exp:
tests/invalid/constrained_poly_insts2.err_exp:
tests/invalid/ho_default_func_4.err_exp:
tests/invalid/merge_ground_any.err_exp:
tests/invalid/polymorphic_unification.err_exp:
Do not expect the deleted comma.
compiler/error_msg_inst.m:
When prettyprinting insts for use in error messages, we have to be careful
to generate finite output even for recursive insts. Previously, we did
the required check when processing user-defined inst names, but not when
processing compiler-generated inst names, which can also be recursive.
Fix this bug, which is Mantis bug 415.
Previously, we passed information about what potentially-recursive inst
names we have seen so far only downward. With the fix above, this avoids
infinite loops, but in some cases, it leads us to print the definition
of a given named inst more than once. Change our approach so that we
now pass information about the set of potentially-recursive inst names
we have seen sideways as well. This can make us generate more compact
and therefore more understandable output when prettyprinting insts that
contain such non-nested duplication.
When printing something that says "inst name x, which expands to ...",
indent the "..." one level deeper than the "inst name x". This visually
separates the thing being defined and its definition.
When prettyprinting complex insts, we show their structure using
indentation levels in the output. Each increase of indentation
should be balanced by a later matching decrease. Move the code that
does the increase and the decrease next to each other, to make it easier
to see the implicit correctness argument.
tests/invalid/bug415.{m,err_exp}:
A new test case for this bug.
tests/invalid/Mmakefile:
Enable the new test case.
tests/invalid/bug117.err_exp:
tests/invalid/bug191.err_exp:
tests/invalid/constrained_poly_insts2.err_exp:
tests/invalid/merge_ground_any.err_exp:
tests/invalid/polymorphic_unification.err_exp:
Expect the extra level of indentation after "which expands to".
tests/invalid/ho_default_func_4.err_exp:
Expect the extra level of indentation after "which expands to",
and expect a repeated inst name NOT to have its definition repeated.
compiler/mode_errors.m:
When printing insts in error messages, use predicates specifically
designed for that purpose.
The insts output by these predicates improve on the existing output
in the following ways.
- We now show the structure of complex insts through indentation.
- We now show both the name of named insts, and their expansion.
Sometimes, you need the expanded inst to understand the error message,
in the case of recursive insts, you cannot expand them forever.
Since the expansion *has* to refer to the inst name, showing that name
at the *start* of the expansion is necessary to allow readers to
understand the inst.
- We now eliminate the module qualification from the names of function
symbols. The module qualifiers on function symbols are specified
by the type, not the inst, of the relevant term, and if we get to
the point of mode analysis having been run, then the predicate
we are generating errors for must be *type* correct, though obviously
it is not *mode* correct.
- We now eliminate the module qualification from names of named insts
if the module qualifier is the name of the module being compiled.
This is a common case, and in these cases, the module qualifier
in the error message acts as clutter, making it *harder* to read.
- We now avoid printing parentheses that humans never need, but which
the parser sometimes does, and which the existing inst output predicates
therefore had to print.
- Higher order insts contain the modes of the function or predicate.
We now print the builtin modes as e.g. "in" instead of the old
"free >> ground".
compiler/error_util.m:
Add some utility predicates now needed by mode_errors.m.
tests/invalid/any_passed_as_ground.err_exp2:
tests/invalid/anys_in_negated_contexts.err_exp:
tests/invalid/bind_in_negated.err_exp:
tests/invalid/bug117.err_exp:
tests/invalid/bug191.err_exp:
tests/invalid/constrained_poly_insts.err_exp:
tests/invalid/constrained_poly_insts2.err_exp:
tests/invalid/ho_any_inst.err_exp:
tests/invalid/ho_default_func_1.err_exp:
tests/invalid/ho_default_func_2.sub.err_exp:
tests/invalid/ho_default_func_3.err_exp:
tests/invalid/ho_default_func_4.err_exp:
tests/invalid/ho_type_mode_bug.err_exp:
tests/invalid/merge_ground_any.err_exp:
tests/invalid/merge_inst_error.err_exp:
tests/invalid/multimode_dcg.err_exp:
tests/invalid/occurs.err_exp:
tests/invalid/partial_implied_mode.err_exp:
tests/invalid/polymorphic_unification.err_exp:
tests/invalid/qualified_cons_id2.err_exp:
tests/invalid/state_vars_test4.err_exp:
tests/invalid/try_detism.err_exp2:
tests/warnings/unify_f_g.exp:
Update expected outputs.
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.
Estimated hours taken: 10
Branches: main, release
Do not allow discriminated unions with a single zero-arity constructor to have
user-defined equality or comparison. Defining such types causes an assertion
failure in the compiler because the types are considered to be dummy types and
the runtime currently doesn't support (and probably won't ever) d.u. dummy
types with user-defined equality or comparison.
Fix another bug where the compiler was not printing out the `recompile with
-E' prompt at the appropriate time. The bug was caused by the fact that there
were several copies of the globals structure and the one that was being
checked at the time the prompt was being printed out was not the one that had
been updated during the rest of compilation.
compiler/add_types.m:
Emit an error message if an attempt is made to define a d.u. dummy
type with user-defined equality or comparison.
compiler/globals.m:
Remove the extra_error_info field from the globals structure and turn
it into a mutable. Export access predicates for this mutable. The
reason for doing this is that the compiler was sometimes looking at
the wrong copy of the globals structure when checking the value of
this flag - this meant that sometimes the recompile with `-E' prompt
was not being displayed. Turning this flag into a mutable avoids the
problem because now there is only one copy.
compiler/make_hlds.m:
s/__/./ in a few spots.
doc/reference_manual.texi:
Mention the new restrictions on discriminated union types with
user-defined equality or comparison.
tests/invalid/exported_unify2.m:
tests/invalid/exported_unify3.m:
Change some types with user-defined equality or comparison so that
they are no longer dummy types. These test cases have not been
triggering the assertion failure in the compiler because they are only
error checked and the assertion that is failing occurs further along
in the compilation process.
tests/invalid/user_eq_dummy.{m,err_exp}:
Test the new error message for dummy types with user-defined equality
or comparison.
tests/invalid/extra_info_prompt.{m,err_exp}:
Test that the recompile with `-E' prompt is being displayed when it
should.
tests/invalid/Mercury.options:
tests/invalid/Mmakefile:
Include the new test cases.
Where there is a verbose version of the error message compile with
`-E'.
tests/recompilation/add_type_re.err_exp.2:
tests/invalid/*.err_exp:
Update expected outputs to conform to the above.
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: 8
Branches: main
Move the rest of mode_errors.m to use error_util.
compiler/mode_errors.m:
The parts of this module that generate error messages (as opposed to
progress messages) now all return a description of the error to a
central place for printing by error_util.m. This should make it
significantly easier to add new error messages.
compiler/error_util.m:
Add the new capability to support mode_errors.m: that of describing
in one data structure a sequence of calls to write_error_pieces.
compiler/hlds_out.m:
Given a bunch of existing predicates that print various things,
provide versions that convert those things to strings, for use
in mode_errors.m.
Write_unify_context had two versions for printing and only one version
for conversion to pieces; add the second version for conversion to
pieces. Change the order of arguments of the five-argument version
of write_unify_context to allow the use of state variables.
compiler/mercury_to_mercury.m:
compiler/prog_out.m:
Given a bunch of existing predicates that print various things,
provide versions that convert those things to strings, for use
in hlds_out.m and mode_errors.m.
compiler/det_report.m:
Conform to the changed argument order of write_unify_context.
library/term_io.m:
Fix an old bug: the code of add_escaped_char wasn't actually doing
any escaping. hlds_out.m now relies on it doing so.
tests/hard_coded/xmlable_test.m:
Due to the bugfix in term_io.m, string__string now protects &s with
backslashes; expect this.
tests/invalid/*.err_exp:
Expect mode error messages in the new, better format.
Estimated hours taken: 4
Branches: main
compiler/mode_errors.m:
Convert this module to four-space indentation to reduce the number
of bad line breaks. Fix some departures from our coding standards.
Convert most of this module to use error_util.m to format error
messages instead just io__write_strings. (Converting the rest
will require some changes in hlds_out.m.)
compiler/error_util.m:
Provide the ability to add prefixes in front of following format
components, and the ability to influence the indentation level
when starting a new line. This is needed to support some of the new
uses of error_util in mode_errors.m.
compiler/state_var.m:
Remove a redundant format component that causes a minor test case
discrepancy with the new code in error_util.m.
compiler/modes.m:
Minor style fixes.
tests/invalid/*.err_exp:
Expect better format in mode error messages.
Estimated hours taken: 0.5
Branches: main
invalid/*.err_exp:
Update the expected output for these test cases since
the compiler now generates error messages that doesn't
use the deprecated syntax for mode declarations.
Estimated hours taken: 14
Branches: main
Change the compiler and tools so that `.' and not `:' is now used as the
module separator in all output.
Infix `.' now has associativity yfx and priority 10.
NEWS:
Report the change.
configure.in:
Amend the test for an up-to-date Mercury compiler to check whether
it recognises `.' as a module qualifier.
compiler/code_gen.m:
compiler/error_util.m:
compiler/hlds_out.m:
compiler/prog_out.m:
compiler/prog_util.m:
compiler/rl_exprn.m:
compiler/rl_gen.m:
compiler/source_file_map.m:
compiler/unused_args.m:
library/io.m:
library/rtti_implementation.m:
library/type_desc.m:
runtime/mercury_debug.c:
runtime/mercury_deconstruct.c:
runtime/mercury_stack_trace.c:
Change `:' to `.' as module separator for output.
compiler/mercury_to_mercury.m:
compiler/prog_io_typeclass.m:
As above.
Fixed a bug where `.' was not being recognised as a module separator.
doc/reference_manual.texi:
Report the change.
library/term_io.m:
Ensure that infix `.' is written without surrounding spaces.
tests/hard_coded/dot_separator.m:
tests/hard_coded/dot_separator.exp:
tests/hard_coded/Mmakefile:
Test case added.
Estimated hours taken: 4
Branches: main
Improve the display of insts in mode error messages.
In particular, fully expand all compiler-defined insts;
places where recursive insts refer to themselves are printed as "...".
compiler/mode_errors.m:
Change the argument of output_inst from instvar_set to mode_info,
so that it can have access to the module_info's inst_table.
Call mercury_output_expanded_inst instead of mercury_output_inst.
compiler/mercury_to_mercury.m:
Add new procedures mercury_output_expanded_inst, for use by
mode_errors.m, and mercury_expanded_inst_to_string, for consistency
with the rest of the interface.
These procedures take an extra module_info argument.
They output the inst in a format where all compiler-defined insts
have been expanded out; recursive insts have their self-referential
parts printed out as elipses ("...").
compiler/mode_util.m:
Change strip_builtin_qualifiers_from_inst so that it handles
compiler-defined insts properly, rather than just deleting
typed_ground and typed_inst insts and ignoring the rest.
tests/invalid/merge_ground_any.err_exp:
tests/invalid/polymorphic_unification.err_exp:
Update error messages to reflect the new output.
Estimated hours taken: 2
Branches: main
compiler/typecheck.m:
Use more meaningful variable names when an argument
has the same name in all clauses.
Rename variables so that both arguments of
a clause like `p(X, X).' are both called `X'
in the debugger.
tests/debugger/print_goal.{m,inp,exp}:
Add a test case.
tests/debugger/field_names.exp:
tests/debugger/interpreter.exp:
tests/invalid/aditi_update_mode_errors.err_exp:
tests/invalid/merge_ground_any.err_exp:
tests/invalid/polymorphic_unification.err_exp:
Update expected output.
Estimated hours taken: 1
Branches: main, release
tests/invalid/polymorphic_unification.err_exp:
Update the expected output for this test case to reflect my
recent change to compiler/modecheck_unify.m.
My recent change actually made the compiler's output for this
case less informative, but this case is pretty rare, and it's
better to give less informative output in some cases
that to give incorrect output in some cases.
Estimated hours taken: 4
Merge in the changes from the existential_types_2 branch.
This change adds support for mode re-ordering of code involving
existential types. The change required modifying the order of the
compiler passes so that polymorphism comes before mode analysis,
so that mode analysis can check the modes of the `type_info' or
`typeclass_info' variables that polymorphism introduces, so that
it can thus re-order the code accordingly.
This change also includes some more steps towards making existential data
types work. In particular, you should be able to declare existentially
typed data types, the compiler will generate appropriate unification
and compare/3 routines for them, and deconstruction unifications for them
should work OK. However, currently there's no way to construct them
except via `pragam c_code', and we don't generate correct RTTI for them,
so you can't use `io__write' etc. on them.
library/private_builtin.m:
compiler/accumulator.m:
compiler/bytecode_gen.m:
compiler/check_typeclass.m:
compiler/clause_to_proc.m:
compiler/code_util.m:
compiler/common.m:
compiler/dead_proc_elim.m:
compiler/dependency_graph.m:
compiler/det_analysis.m:
compiler/det_report.m:
compiler/follow_code.m:
compiler/follow_vars.m:
compiler/goal_util.m:
compiler/higher_order.m:
compiler/hlds_goal.m:
compiler/hlds_out.m:
compiler/hlds_pred.m:
compiler/intermod.m:
compiler/lambda.m:
compiler/live_vars.m:
compiler/magic.m:
compiler/make_hlds.m:
compiler/mercury_compile.m:
compiler/mercury_to_c.m:
compiler/mode_errors.m:
compiler/mode_info.m:
compiler/mode_util.m:
compiler/modecheck_call.m:
compiler/modecheck_unify.m:
compiler/modes.m:
compiler/pd_cost.m:
compiler/polymorphism.m:
compiler/post_typecheck.m:
compiler/purity.m:
compiler/quantification.m:
compiler/rl_exprn.m:
compiler/rl_key.m:
compiler/simplify.m:
compiler/table_gen.m:
compiler/term_traversal.m:
compiler/type_util.m:
compiler/typecheck.m:
compiler/unify_gen.m:
compiler/unify_proc.m:
compiler/unique_modes.m:
compiler/unused_args.m:
compiler/notes/compiler_design.html:
doc/reference_manual.texi:
tests/hard_coded/typeclasses/Mmakefile:
tests/hard_coded/typeclasses/existential_data_types.m:
tests/hard_coded/typeclasses/existential_data_types.exp:
tests/warnings/simple_code.exp:
tests/hard_coded/Mmakefile:
tests/term/arit_exp.trans_opt_exp:
tests/term/associative.trans_opt_exp:
tests/term/pl5_2_2.trans_opt_exp:
tests/term/vangelder.trans_opt_exp:
tests/term/arit_exp.trans_opt_exp:
tests/term/associative.trans_opt_exp:
tests/term/pl5_2_2.trans_opt_exp:
tests/term/vangelder.trans_opt_exp:
tests/invalid/errors2.err_exp2:
tests/invalid/prog_io_erroneous.err_exp2:
tests/invalid/type_inf_loop.err_exp2:
tests/invalid/types.err_exp2:
tests/invalid/polymorphic_unification.err_exp:
tests/invalid/Mmakefile:
tests/warnings/simple_code.exp:
tests/debugger/queens.exp:
tests/hard_coded/Mmakefile:
tests/hard_coded/existential_reordering.m:
tests/hard_coded/existential_reordering.exp:
Merge in the changes from the existential_types_2 branch.
Estimated hours taken: 2
compiler/polymorphism.m:
Abort if there is a polymorphic unification that is in
a partially instantiated mode. This error should be
caught earlier (probably during mode analysis), but it's
best to abort rather than just go ahead and generate
bad code.
tests/invalid/polymorphic_unification.m:
tests/invalid/polymorphic_unification.err_exp:
A test case for the above change.
tests/invalid/Mmakefile:
Turn this test case on.