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.
Estimated hours taken: 8
Branches: main
compiler/*.m:
Rename the types 'type', 'inst' and 'mode' to 'mer_type', 'mer_inst'
and 'mer_mode'. This is to avoid the need to parenthesize these type
names in some contexts, and to prepare for the possibility of a parser
that considers those words to be reserved words.
Rename some other uses of those names (e.g. as item types in
recompilation.m).
Delete some redundant synonyms (prog_type, mercury_type) for mer_type.
Change some type names (e.g. mlds__type) and predicate names (e.g.
deforest__goal) to make them unique even without module qualification.
Rename the function symbols (e.g. pure, &) that need to be renamed
to avoid the need to parenthesize them. Make their replacement names
more expressive.
Convert some more modules to four space indentation.
Avoid excessively long lines, such as those resulting from the
automatic substitution of 'mer_type' for 'type'.
Estimated hours taken: 1
Branches: main
Fix a bug in closure analysis where the values of higher-order
variables was not being recorded correctly at generic_calls.
compiler/closure_analysis.m:
Make sure to record closure information for all of the
arguments of call/N or apply/N.
Fix the formatting of the progress message.
Estimated hours taken: 30
Branches: main
Implement a procedure-local closure analysis that tracks the possible
values of higher-order valued variables within a procedure. We will
eventually replace this with a more sophisticated analysis that tracks
these values across procedure and module boundaries but we need something
of this capability now in order to continue development of the termination
and exception analyses.
This analysis is similar to that carried out by higher-order
specialization except here we do keep track of higher-order variables
that have multiple possible values.
compiler/closure_analysis.m:
Keep track of the possible values of higher-order variables
within a procedure. Annotate goals in the HLDS with this
information where it might prove useful.
compiler/hlds_goal.m:
Add an extra field to the goal_info that is designed
to hold the results of optional analysis passes. At
the moment this is only used to hold the results of
closure analysis.
compiler/options.m:
compiler/mercury_compile.m:
Add code to invoke the new analysis. Closure analysis
is stage 117, directly before exception analysis.
compiler/passes_aux.m:
Add a version of write_proc_progress_message, that does
not require the caller to deconstruct a pred_proc_id.
compiler/prog_type.m:
Add a predicate type_is_higher_order/1 that is similar
type_is_higher_order/5 except that it doesn't have any
outputs.
compiler/transform_hlds.m:
Include the new module.
doc/user_guide.texi:
Document the '--analyse-closures' and '--debug-closures'
options. The documentation is currently commented out until
closure analysis is useful for something.
doc/reference_manual.texi:
s/must have give a definition/must give a definition/
*/.cvsignore:
Have CVS ignore the various *_FLAGS files generated
by the configure script.