Files
mercury/tests/invalid/det_errors_deep.err_exp
Zoltan Somogyi f9fe8dcf61 Improve the error messages generated for determinism errors involving committed
Estimated hours taken: 8
Branches: main

Improve the error messages generated for determinism errors involving committed
choice contexts. Previously, we printed a message to the effect that e.g.
a cc pred is called in context that requires all solutions, but we didn't say
*why* the context requires all solutions. We now keep track of all the goals
to the right that could fail, since it is these goals that may reject the first
solution of a committed choice goal.

The motivation for this diff was the fact that I found that locating the
failing goal can be very difficult if the conjunction to the right is
a couple of hundred lines long. This would have been a nontrivial problem,
since (a) unifications involving values of user-defined types are committed
choice goals, and (b) we can expect uses of user-defined types to increase.

compiler/det_analysis.m:
	Keep track of goals to the right of the current goal that could fail,
	and include them in the error representation if required.

compiler/det_report.m:
	Include the list of failing goals to the right in the representations
	of determinism errors involving committed committed choice goals.

	Convert the last part of this module that wasn't using error_util
	to use error_util. Make most parts of this module just construct
	error message specifications; print those specifications (using
	error_util) in only a few places.

compiler/hlds_out.m:
	Add a function for use by the new code in det_report.m.

compiler/error_util.m:
	Add a function for use by the new code in det_report.m.

compiler/error_util.m:
compiler/compiler_util.m:
	Error_util is still changing reasonably often, and yet it is
	included in lots of modules, most of which need only a few simple
	non-parse-tree-related predicates from it (e.g. unexpected).
	Move those predicates to a new module, compiler_util.m. This also
	eliminates some undesirable dependencies from libs to parse_tree.

compiler/libs.m:
	Include compiler_util.m.

compiler/notes/compiler_design.html:
	Document compiler_util.m, and fix the documentation of some other
	modules.

compiler/*.m:
	Import compiler_util instead of or in addition to error_util.
	To make this easier, consistently use . instead of __ for module
	qualifying module names.

tests/invalid/det_errors_cc.{m,err_exp}:
	Add this new test case to test the error messages for cc contexts.

tests/invalid/det_errors_deet.{m,err_exp}:
	Add this new test case to test the error messages for unifications
	inside function symbols.

tests/invalid/Mmakefile:
	Add the new test cases.

tests/invalid/det_errors.err_exp:
tests/invalid/magicbox.err_exp:
	Change the expected output to conform to the change in det_report.m,
	which is now more consistent.
2005-10-28 02:11:03 +00:00

32 lines
1.8 KiB
Plaintext

det_errors_deep.m:010: In `p1(in, in, out)':
det_errors_deep.m:010: error: determinism declaration not satisfied.
det_errors_deep.m:010: Declared `det', inferred `semidet'.
det_errors_deep.m:019: In argument 2 of clause head:
det_errors_deep.m:019: unification of `HeadVar__2' and `X' can fail.
det_errors_deep.m:011: In `p2(in, in, out)':
det_errors_deep.m:011: error: determinism declaration not satisfied.
det_errors_deep.m:011: Declared `det', inferred `semidet'.
det_errors_deep.m:022: In argument 2 of clause head:
det_errors_deep.m:022: in argument 2 of functor `node/3':
det_errors_deep.m:022: unification with `X' can fail.
det_errors_deep.m:012: In `p3(in, in, out)':
det_errors_deep.m:012: error: determinism declaration not satisfied.
det_errors_deep.m:012: Declared `det', inferred `semidet'.
det_errors_deep.m:024: In argument 2 of clause head:
det_errors_deep.m:024: unification of `HeadVar__2' and
det_errors_deep.m:024: `det_errors_deep.node(_L, V_8, _R)' can fail.
det_errors_deep.m:024: In argument 2 of clause head:
det_errors_deep.m:024: in argument 2 of functor `node/3':
det_errors_deep.m:024: unification with `X' can fail.
det_errors_deep.m:013: In `p4(in, in, out)':
det_errors_deep.m:013: error: determinism declaration not satisfied.
det_errors_deep.m:013: Declared `det', inferred `semidet'.
det_errors_deep.m:027: In argument 2 of clause head:
det_errors_deep.m:027: unification of `HeadVar__2' and `X' can fail.
det_errors_deep.m:028: In argument 1 of clause head:
det_errors_deep.m:028: in argument 3 of functor `node/3':
det_errors_deep.m:028: in argument 2 of functor `node/3':
det_errors_deep.m:028: unification with `X' can fail.
det_errors_deep.m:028: In argument 2 of clause head:
det_errors_deep.m:028: unification of `HeadVar__2' and `X' can fail.