Commit Graph

7 Commits

Author SHA1 Message Date
Zoltan Somogyi
be8ecd7c9b Add "Error:" at the start of an error message. 2021-10-17 09:44:34 +11:00
Zoltan Somogyi
cfe6782dd2 Improve diagnostics for circular insts and modes.
compiler/add_mode.m:
    Improve diagnostics for circular insts and modes in several ways.

    - Generate one error message per cycle, not one error message per inst.
      In the case of cycles containing more than one inst or mode, this
      reduces clutter.

    - Unlike the old code, we do print a context for every inst or mode
      in a cycle, rather than just for the first.

    - Avoid module qualifying local inst and mode names unless that
      qualification actually avoids ambiguity.

    - Use more expansive wording that actually explains *why* a circular
      inst or mode is a problem.

tests/invalid/circ_inst5.m:
    Extend this test case to test corner cases of the new code.

tests/invalid/circ_inst.err_exp:
tests/invalid/circ_inst2.err_exp:
tests/invalid/circ_inst3.err_exp:
tests/invalid/circ_inst4.err_exp:
tests/invalid/circ_inst5.err_exp:
tests/invalid/circ_mode.err_exp:
tests/invalid/circ_mode2.err_exp:
tests/invalid/circ_mode3.err_exp:
tests/invalid/circ_mode4.err_exp:
    Expect the updated error messages.
2021-10-16 12:14:49 +11:00
Zoltan Somogyi
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.
2015-02-16 12:32:18 +11:00
Julien Fischer
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.
2005-09-14 05:27:11 +00:00
Zoltan Somogyi
6df9a05856 This diff cleans up a bunch of modules. It has no algorithmic changes
Estimated hours taken: 10
Branches: main

This diff cleans up a bunch of modules. It has no algorithmic changes
other than in the formatting of error messages.

compiler/error_util.m:
	Delete the obsolete predicate append_punctuation, since the suffix
	format component can now do more, and do it more easily.

compiler/goal_util.m:
compiler/hlds_goal.m:
compiler/hlds_llds.m:
compiler/instmap.m:
compiler/const_prop.m:
	Change the argument order of some the predicates exported by these
	modules to make them easier to use with state variable syntax.

compiler/*.m:
	Convert a bunch of these modules to four space indentation, and fix
	departures from our coding style.

	Conform to the changed argument order above.

	Use suffixes instead of append_punctuation.

library/string.m:
	Add string.foldl2.

tests/invalid/circ_*.err_exp:
tests/warnings/unused_args_*.exp:
	Expect the updated error messages, which format sym_names consistently
	the same way as other messages.
2005-08-30 04:12:17 +00:00
Fergus Henderson
721620f088 Update to reflect Ralph's recent change to use .' rather than :'
Branches: main
Estimated hours taken: 0.5

tests/invalid/circ_inst5.err_exp:
tests/invalid/reserve_tag.err_exp:
	Update to reflect Ralph's recent change to use `.' rather than `:'
	as the module separator in compiler error messages.
2003-01-18 05:50:18 +00:00
Mark Brown
532bc4b86c Fix another problem with circularly defined insts.
Estimated hours taken: 0.5
Branches: main, release

Fix another problem with circularly defined insts.

compiler/make_hlds.m:
	When checking for circularly defined insts, substitute the correct
	arguments for user defined insts.  Use unrelated insts as the
	inital argument values (in this case, use not_reached for all of
	them).

tests/invalid/Mmakefile:
	Add some new tests.

tests/invalid/circ_inst5.err_exp:
tests/invalid/circ_inst5.m:
	A test case where looping occurs via an argument substitution.
	Before this change, attempting to compile this module would result
	in a loop.

tests/invalid/circ_type5.err_exp:
tests/invalid/circ_type5.m:
	A similar test case for equivalence types.  The algorithm to expand
	equivalence types already handled this case correctly, but it was
	untested.

	There is no corresponding test case for modes, since this kind of
	error cannot occur in mode declarations.
2003-01-12 02:45:22 +00:00