mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-15 17:33:38 +00:00
e00722533b25ea353e4c3adcc178f00a92fcfbf3
20 Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
2526c4b8cb |
Split possible_cause into hint and inconsistent.
compiler/error_spec.m:
Replace the possible_cause color name with the hint and inconsistent
color names, as agreed on m-rev.
compiler/globals.m:
compiler/write_error_spec.m:
Update the code handling color names and their mapping to color shades.
compiler/options.m:
Update the invisible options that record that mapping.
tools/bootcheck:
Update the color scheme used for the test suite.
compiler/accumulator.m:
compiler/add_pragma.m:
compiler/add_pragma_tabling.m:
compiler/add_type.m:
compiler/check_typeclass.m:
compiler/equiv_type.m:
compiler/format_call_errors.m:
compiler/inst_check.m:
compiler/make_hlds_error.m:
compiler/make_hlds_passes.m:
compiler/make_hlds_warn.m:
compiler/mode_errors.m:
compiler/module_qual.qual_errors.m:
compiler/parse_item.m:
compiler/parse_mutable.m:
compiler/parse_pragma.m:
compiler/parse_type_defn.m:
compiler/post_typecheck.m:
compiler/simplify_goal_call.m:
compiler/simplify_proc.m:
compiler/split_parse_tree_src.m:
compiler/state_var.m:
compiler/termination.m:
compiler/typecheck_error_overload.m:
compiler/typecheck_error_undef.m:
compiler/typecheck_errors.m:
Replace uses of the possible_cause color with one of its replacements.
In a few cases, adjust some other colors as well.
tests/invalid/bad_statevar_bad_context.err_exp:
tests/invalid/bind_in_negated.err_exp:
tests/invalid/bug197.err_exp:
tests/invalid/bug487.err_exp:
tests/invalid/coerce_disambig.err_exp:
tests/invalid/coerce_implied_mode.err_exp:
tests/invalid/coerce_infer.err_exp:
tests/invalid/coerce_non_du.err_exp:
tests/invalid/coerce_type_error.err_exp:
tests/invalid/coerce_unify_tvars.err_exp:
tests/invalid/conflicting_tabling_pragmas.err_exp:
tests/invalid/dcg_context.err_exp:
tests/invalid/default_ho_inst_2.err_exp:
tests/invalid/fbnf.err_exp:
tests/invalid/freefree.err_exp:
tests/invalid/functor_ho_inst_bad_1.err_exp:
tests/invalid/functor_ho_inst_bad_3.err_exp:
tests/invalid/higher_order_mode_mismatch.err_exp:
tests/invalid/ho_type_mode_bug.err_exp:
tests/invalid/merge_inst_error.err_exp:
tests/invalid/mode_inf.err_exp:
tests/invalid/modes_erroneous.err_exp:
tests/invalid/multimode_dcg.err_exp:
tests/invalid/partial_implied_mode.err_exp:
tests/invalid/quant_constraint_1.err_exp:
tests/invalid/quant_constraint_2.err_exp:
tests/invalid/string_format_bad.err_exp:
tests/invalid/string_format_unknown.err_exp:
tests/invalid/test_may_duplicate.err_exp:
tests/invalid/test_may_export_body.err_exp:
tests/invalid/type_diff.err_exp:
tests/invalid/typeclass_dup_method_mode.err_exp:
tests/invalid_make_int/bad_mutable_int.int_err_exp:
tests/invalid_nodepend/duplicate_modes.err_exp:
tests/invalid_nodepend/errors_2.err_exp:
tests/invalid_nodepend/occurs.err_exp:
tests/invalid_nodepend/require_tailrec_invalid.err_exp:
tests/invalid_nodepend/test_with_type.err_exp:
tests/invalid_nodepend/unbound_type_vars.err_exp:
tests/invalid_purity/impure_pred_t1_fixed.err_exp:
tests/invalid_purity/impure_pred_t2.err_exp:
tests/invalid_purity/purity_nonsense_1.err_exp:
tests/invalid_purity/purity_nonsense_2.err_exp:
tests/warnings/foreign_term_invalid.err_exp:
tests/warnings/format_call_multi.err_exp:
tests/warnings/format_call_warning.err_exp:
tests/warnings/table_with_inline.err_exp:
tests/warnings/warn_succ_ind.err_exp:
tests/warnings/warn_succ_ind.err_exp2:
tests/warnings/warn_succ_ind.err_exp3:
Expect updated diagnostics.
|
||
|
|
24ec389860 |
Improve diagnostics about missing ::mode annotations.
compiler/add_clause.m:
When a mode-specific clause is missing a ::mode annotation from some
arguments, print the identities of those arguments.
compiler/add_pred.m:
Improve the wording of a diagnostic.
tests/invalid/mode_decl_in_wrong_section.err_exp:
tests/invalid/multimode_dcg.err_exp:
tests/invalid/multimode_dcg.m:
tests/invalid/multimode_syntax.err_exp:
Expect updated diagnostics.
|
||
|
|
4da9c3745e |
Use understated colors in mode_errors.m.
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.
|
||
|
|
9f2d94d3ed |
Use color in parse_type_defn.m and other modules.
compiler/add_clause.m:
compiler/check_for_missing_type_defns.m:
compiler/parse_type_defn.m:
compiler/field_access.m:
compiler/goal_expr_to_goal.m:
Add color to the diagnostics generated by these modules.
In a few cases, improve the wording of the diagnostic.
compiler/add_type.m:
Address a review comment.
compiler/error_spec.m:
Generalize a function for use by check_for_missing_type_defns.m.
compiler/make_hlds.m:
Update the obsoleted part of a comment.
tests/invalid_make_int/Mmakefile:
Enable the use of color for the diagnostics in this test directory.
tests/invalid/make_opt_error.err_exp:
tests/invalid/multimode_dcg.err_exp:
tests/invalid/multimode_syntax.err_exp:
tests/invalid/record_syntax_errors.err_exp:
tests/invalid/ref_to_implicit_comma.err_exp:
tests/invalid/subtype_user_compare.err_exp:
tests/invalid/try_io_else.err_exp:
tests/invalid/type_no_arrow.err_exp:
tests/invalid/type_with_no_defn.err_exp:
tests/invalid/types2.err_exp:
tests/invalid_make_int/bad_existential_data_type.int_err_exp:
tests/invalid_make_int/bad_foreign_type_int.int_err_exp:
tests/invalid_make_int/type_vars_int.int_err_exp:
tests/invalid_nodepend/bigtest.err_exp:
tests/invalid_nodepend/errors_1.err_exp:
tests/invalid_nodepend/errors_3.err_exp:
tests/invalid_nodepend/fundeps_unbound_in_ctor.err_exp:
tests/invalid_nodepend/subtype_syntax.err_exp:
tests/invalid_nodepend/type_lhs_var.err_exp:
tests/invalid_nodepend/types.err_exp:
tests/invalid_nodepend/uu_type.err_exp:
tests/invalid_nodepend/where_abstract_enum.err_exp:
tests/invalid_nodepend/where_direct_arg_1.err_exp:
tests/invalid_nodepend/where_direct_arg_2.err_exp:
tests/warnings/unneeded_mode_specific_clause.err_exp:
Expect updated diagnostics.
|
||
|
|
75dc210ab3 |
Color subjects in mode errors.
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.
|
||
|
|
af90a1702c |
Use color in mode error diagnostics.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.
|
||
|
|
d1c08a30f1 |
Improve messages for merge mode errors.
compiler/mode_errors.m:
When some branches of a disjunction, switch or if-then-else ground
a variable but other branches don't, print just this fact about each
branch. We used to print the insts themselves, but this is just clutter
that does not help programmers locate the source of the error.
Be consistent about the use of indentation in error messages.
Use bespoke types instead of booleans in the code affected by this change.
tests/invalid/default_ho_inst_2.err_exp:
tests/invalid/merge_inst_error.err_exp:
tests/invalid/multimode_dcg.err_exp:
Expect the updated error messages.
|
||
|
|
4aed1a57e4 |
Print an arg type list diff for arg lists with wrong arity.
When a user writes a clause for a predicate (or function) that does not exist
with that arity, but does exist with one or more other arities, report not
just the list of the other arity/arities, but, for each such other arity,
a diff between the declared arg types and the inferred arg types.
After this diff, we generate output like this:
bad_pred_arity.m:027: Error: clause for predicate `bad_pred_arity.p'/4
bad_pred_arity.m:027: without corresponding `:- pred' declaration.
bad_pred_arity.m:027: However, predicates of that name do exist with arities
bad_pred_arity.m:027: 3 and 5.
bad_pred_arity.m:027: Inferred :- pred p(int, string, int, string).
bad_pred_arity.m:027: The argument list difference from the arity 3 version
bad_pred_arity.m:027: is
bad_pred_arity.m:027: pred(
bad_pred_arity.m:027: int,
bad_pred_arity.m:027: + string,
bad_pred_arity.m:027: int,
bad_pred_arity.m:027: string
bad_pred_arity.m:027: )
bad_pred_arity.m:027: The argument list difference from the arity 5 version
bad_pred_arity.m:027: is
bad_pred_arity.m:027: pred(
bad_pred_arity.m:027: int,
bad_pred_arity.m:027: - float,
bad_pred_arity.m:027: string,
bad_pred_arity.m:027: int,
bad_pred_arity.m:027: string
bad_pred_arity.m:027: )
compiler/typecheck_errors.m:
Generate the diff part of the message above.
compiler/typecheck.m:
Invoke typecheck_errors.m when relevant.
compiler/error_util.m:
When comparing two error_specs, switch from a two-level comparison
(first the contexts of error_msgs, then everything else) to three levels
first the contexts of error_msgs, then their error_msg_components,
then everything else). This is needed to allow the error message from
make_hlds_error.m (which reports the error and mentions the arities
with which the named predicate or function does exist) come out before
the informational message from typecheck.m that prints the inferred
arg types and their differences from the other arities. (With the old
comparison, the difference in severity would trump the invisible order
components that this diff includes in both specs to force the desire
order.)
Base the code comparing error_specs on the code for comparing error_msgs.
Move the two previously separate pieces code for those tasks next to each
other.
compiler/make_hlds_error.m:
Add the invisble ordering component.
When we see clauses with two or more wrong arities for a given predicate
or function, don't list the automatically created pred declaration
for an *earlier* wrong-arity clause as a real declaration whose arity
is to be listed in the error messages we generate for *later* wrong-arity
clauses.
Add some documentation.
compiler/add_pred.m:
Factor out some common code.
library/edit_seq.m:
A new module for computing diffs.
library/library.m:
library/MODULES_DOC:
Add the new module to the standard library.
tests/hard_coded/edit_seq_test.{m,exp}:
A new test case for the diff algorithm.
tests/invalid/bad_pred_arity.{m,err_exp}:
A new test case for the new error message.
tests/hard_coded/Mmakefile:
tests/invalid/Mmakefile:
Enable the new test cases.
tests/invalid/bigtest.err_exp:
tests/invalid/bug197.err_exp:
tests/invalid/bug278.err_exp:
tests/invalid/errors2.err_exp:
tests/invalid/invalid_binary_literal.err_exp:
tests/invalid/invalid_float_literal.err_exp:
tests/invalid/invalid_hex_literal.err_exp:
tests/invalid/invalid_main.err_exp:
tests/invalid/invalid_octal_literal.err_exp:
tests/invalid/multimode_dcg.err_exp:
tests/invalid/multisoln_func.err_exp:
tests/invalid/null_char.err_exp:
tests/invalid/state_vars_test3.err_exp:
tests/invalid/try_detism.err_exp2:
tests/invalid/typeclass_test_5.err_exp:
tests/invalid/typeclass_test_8.err_exp:
tests/invalid/unsatisfiable_constraint.err_exp:
tests/invalid_purity/impure_func_t3.err_exp:
Update these files to expect error messages in the new order.
samples/diff/*.m:
Fix comments, mostly by moving them to where our programming style
wants them.
|
||
|
|
3f9d2ca5a0 |
Improve error messages for inst mismatches among branches.
compiler/mode_errors.m:
When more than half of the branches in a disjunction ground a variable,
but some branches leave it non-ground, the error is almost certainly
in the branches that leave the variable non-ground. Therefore users
are very likely to find the ground insts we print for the branches
that ground the variable to be just clutter.
Change things so that by default, we print the inst of the variable
only for the branches that leave it non-ground. (We still print its inst
in all branches with verbose errors.)
To make the messages processable by the error utility, in the message
about the inst of the variable in a branch, print the context of the
branch in the usual context position, not in the body of the message.
compiler/error_util.m:
Allow for the fact that we can now generate an empty list of messages
for a branch in the non-verbose-errors case.
tests/invalid/default_ho_inst_2.err_exp:
tests/invalid/merge_inst_error.err_exp:
tests/invalid/multimode_dcg.err_exp:
Expect the updated error messages.
|
||
|
|
41b97d2048 |
Generate better error messages for bad insts and modes.
compiler/parse_inst_mode_name.m:
When trying to parse an inst or mode name and failing, we used to just
print the whole term (including the correct parts) and a message about
the mode being invalid. We now print a message for each incorrect *part*
of a term, and make its message specific to the particular problem.
Rename the predicates that parse insts and modes to include "parse"
in their names, and make them take the additional arguments needed
for detailed error reporting.
compiler/parse_sym_name.m:
Put the arguments of a utility predicate in a more sensible order.
compiler/add_clause.m:
compiler/parse_class.m:
compiler/parse_inst_mode_defn.m:
compiler/parse_item.m:
compiler/parse_mutable.m:
compiler/parse_pragma.m:
compiler/parse_tree_out.m:
compiler/parse_type_defn.m:
compiler/parse_type_name.m:
compiler/parse_util.m:
compiler/superhomogeneous.m:
Conform to the changes above. Make some minor improvements.
compiler/hlds_out_util.m:
Add a utility predicate for use by the code above.
Avoid throwing an unnecessary exception.
tests/invalid/combined_ho_type_inst.err_exp:
tests/invalid/impl_def_literal_syntax.err_exp:
tests/invalid/inst_list_dup.err_exp:
tests/invalid/multimode_dcg.err_exp:
tests/invalid/multimode_syntax.err_exp:
tests/invalid/predmode.err_exp:
tests/invalid/with_type.err_exp:
Expect the improved error messages.
|
||
|
|
f4ad6de055 |
Generate more readable mode errors.
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.
|
||
|
|
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.
|
||
|
|
28c66f3358 |
Make the error messages that report mismatches in insts between different
Estimated hours taken: 4
Branches: main
Make the error messages that report mismatches in insts between different
branches of a branched control structure more useful, by reporting not just
the insts of the relevant variable at end of each branch, but also the
location of each branch. This makes it MUCH easier to interpret error
messages about large disjunctions and switches.
compiler/mode_errors.m:
Change the representation of errors of the above kind to include
the context of each inst, and print the contexts next to the insts.
compiler/instmap.m:
Give the predicates that merge instmaps the context of the goals
that the instmaps are talking about, so that if there are any errors,
these contexts can be given to mode_errors.m.
Remove the predicate instmap_unify and its helper predicates, since
it is not used anywhere.
compiler/modecheck_goal.m:
compiler/unique_modes.m:
Associate a context with each instmap before calling instmap.m
to merge those instmaps.
compiler/mercury_to_mercury.m:
Switch the order of the arguments of some functions and predicates
to make it easier to curry them; mode_errors.m wants this
functionality.
compiler/hlds_out_mode.m:
compiler/hlds_out_module.m:
compiler/prog_ctgc.m:
Conform to the changes above.
tests/invalid/merge_inst_error.{m,err_exp}:
New test case to test the new functionality.
tests/invalid/Mmakefile:
Enable the new test case.
tests/invalid/multimode_dcg.err_exp:
Update this expected output as well.
|
||
|
|
cc1711071e |
Make all the pre-HLDS and front-end passes of the compiler gather up
Estimated hours taken: 50 Branches: main Make all the pre-HLDS and front-end passes of the compiler gather up all their error messages and print them all at once, in sorted order, unless the user asked for progress messages, in which case we print all the errors accumulated so far just before each printing each progress message. This should make error message output significantly easier to interpret. compiler/module_imports.m: Add a new field to the module_imports structure (the main pre-HLDS representation of the parse tree) to hold the list of error messages generated so far. Rename the module_imports structure as the module_and_imports structure, since it holds the module's items as well as information about its imports. Update the access predicates to encourage getting the items, the error messages and the error indication all at once. Add mechanisms for updating the error indication and the error messages. Add a distinguishing prefix to the field names of the structure. compiler/error_util.m: compiler/hlds_error_util.m: Add facilities for printing error messages in batches. In error_util.m, delete an unused argument from several predicates. compiler/mercury_compile.m: compiler/intermod.m: Gather up error messages to print in batches. In the parts of the code affected by the above, explicitly pass around a globals structure, instead of having all the predicates get it of the I/O state. Since some code (e.g. the start recompilation system) still uses the copy in the I/O state, we ensure that this copy is kept in sync with the explicitly passed around copy. Rename some predicates to avoid ambiguities. compiler/modules.m: Return errors in the module_and_imports structure, not separately. Gather up error messages to print in batches. Explicitly pass around globals structures. compiler/read_modules.m: Rename the read_modules type to have_read_module_map, since this is more explicit. For each module we have already read, remember not just the items we read from it, but also the error messages we generated during the reading. This is so these error messages can be printed together with other errors from other sources. Explicitly pass around globals structures. compiler/prog_io.m: compiler/purity.m: compiler/stratify.m: Rename several predicates to avoid ambiguities. compiler/modes.m: Change the interface of the main predicate to avoid the need for a lambda expression in mercury_compile.m. compiler/recompilation.check.m: Add a distinguishing prefix to the field names of a structure. Fix a wrong definition of this_file. Conform to the changes above. compiler/compiler_target_code.m: compiler/deps_map.m: compiler/make.m: compiler/make.dependencies.m: compiler/make.module_dep_file.m: compiler/make.module_target.m: compiler/make.program_target.m: compiler/make.util.m: compiler/make_hlds.m: compiler/make_hlds_passes.m: compiler/trans_opt.m: compiler/write_deps_file.m: Conform to the changes above. compiler/add_clause.m: compiler/add_pragma.m: compiler/state_var.m: Add an import of io, since their parent make_hlds.m does not import io anymore. In add_pragma, update an error message that did not mention trseg as well as tr as indicating a trailing grade. tests/hard_coded/Mmakefile: Move two tests that cannot pass in debug grades due to the lack of tail recursion to the list containing the other tests with this property. tests/invalid/test_feature_set.err_exp: Update the expected output of this test to expect the updated error message from add_pragma. tests/invalid/test_feature_set.err_exp2: Add this file as the expected output for trailing grades. tests/invalid/*.err_exp: tests/warnings/*.err_exp: Update the expected output for many tests to expect the error messages in sorted order. |
||
|
|
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. |
||
|
|
835d8315ef |
Do not allow discriminated unions with a single zero-arity constructor to have
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.
|
||
|
|
18c0510231 |
Improve the formatting of some error messages by using error_util
Estimated hours taken: 2
Branches: main
Improve the formatting of some error messages by using error_util
and hlds_error_util to handle the formatting of the error messages.
compiler/error_util.m:
Add a new format component `quote', which is identical to `fixed'
except that it outputs it's argument surrounded by `' quotes.
compiler/add_clause.m:
compiler/add_type.m:
compiler/make_hlds_passes.m:
compiler/options_file.m:
compiler/qual_info.m:
compiler/stratify.m:
Use the error_util to format warning/error messages rather than
doing it manually.
compiler/passes_aux.m:
complier/hlds_out.m:
Update comments.
tests/invalid/errors.err_exp:
tests/invalid/errors1.err_exp:
tests/invalid/multimode_dcg.err_exp:
tests/invalid/multimode_syntax.err_exp:
tests/invalid/sub_c.err_exp:
tests/invalid/types.err_exp:
Update the expected outputs of these test cases to account
for formatting changes introduced by the above.
tests/warnings/Mmakefile:
tests/warnings/Mercury.options:
tests/warnings/non_stratification.{exp,m}:
Add a test case for the `--warn-non-stratification' option.
|
||
|
|
e069d16ab1 |
Do not display the For more information try recompiling with -E'' prompt
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. |
||
|
|
a8ffd3680c |
Change the compiler and tools so that .' and not :' is now used as the
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. |
||
|
|
ce7a41620d |
Add some test cases for my recent change to add support
Estimated hours taken: 2 Branches: main tests/hard_coded/Mmakefile: tests/hard_coded/multimode.m: tests/hard_coded/multimode.exp: tests/invalid/Mmakefile: tests/invalid/multimode_missing_impure.m: tests/invalid/multimode_missing_impure.err_exp: tests/invalid/multimode_dcg.m: tests/invalid/multimode_dcg.err_exp: tests/invalid/multimode_syntax.m: tests/invalid/multimode_syntax.err_exp: Add some test cases for my recent change to add support for using different clauses for different modes. |