[m-rev.] for post-commit review: better determinism error messages

Julien Fischer juliensf at cs.mu.OZ.AU
Sun Oct 30 01:12:56 AEST 2005




On Fri, 28 Oct 2005, Zoltan Somogyi wrote:

> For post-commit review. While the diff is very large, only the parts involving
> the named files below are worth reviewing; the *.m part was done by
> automatic substitution.
>
> Zoltan.
>
> 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.
>
It looks like you didn't cvs add det_errors_cc.m because it hasn't
been committed.

> Index: tests/invalid/det_errors.err_exp
> ===================================================================
> RCS file: /home/mercury/mercury1/repository/tests/invalid/det_errors.err_exp,v
> retrieving revision 1.3
> diff -u -b -r1.3 det_errors.err_exp
> Index: tests/invalid/det_errors_cc.err_exp
> ===================================================================
> RCS file: tests/invalid/det_errors_cc.err_exp
> diff -N tests/invalid/det_errors_cc.err_exp
> --- /dev/null	1 Jan 1970 00:00:00 -0000
> +++ tests/invalid/det_errors_cc.err_exp	27 Oct 2005 15:05:22 -0000
> @@ -0,0 +1,57 @@
> +det_errors_cc.m:055: Error: call to predicate `p1/2' with determinism
> +det_errors_cc.m:055:   `cc_nondet' occurs in a context which requires all
> +det_errors_cc.m:055:   solutions.

I suggest s/which/that/.

The rest of looks fine (and quite useful as well).

Julien.
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list