Change some types that are defined as equivalences for pairs into

Estimated hours taken: 1
Branches: main

Change some types that are defined as equivalences for pairs into
named d.u. types.

Fix a bug in with the handling of type class method calls in the
termination analyser.  We should not run pass 2 if we encounter
a method call during pass 1.

Add an XXX comment about some other possible bugs of a similar nature.

compiler/prog_data.m:
	Define the type arg_size_term/0 as a d.u. type, not a pair.

compiler/term_errors.m:
	Define the type termination_error_context/0 as a d.u. type,
	not a pair.

	Change the semidet predicate indirect_error/1 into a det function
	is_indirect_error/1.

	Add the function is_fatal_error/1.
	(See change to termination.m below.)

compiler/term_pass2.m:
	Define the type call_weight_info/0 as a d.u. type, not a pair.

compiler/termination.m:
	Move the body of the closure that determines if an error is fatal
	into term_errors.m, and make it into a named function that returns
	a bool.  Use that here.  (In the process of doing this I discovered
	that the code for handling fatal errors was not handling type
	class method calls correctly, they *should* be handled like
	higher-order calls.  Also, some of the more recently added
	termination error categories may not be handled correctly here -
	I have added an XXX comment to term_errors.m regarding this.)

compiler/unify_proc.m:
	Define the type unify_proc_id/0 as a d.u. type, not a pair.

compiler/goal_store.m:
	Define the type stored_goal/0 as a d.u. type, not a pair.

compiler/mode_errors.m:
	Define the type merge_error/0 as a d.u. type, not a pair.

compiler/accumulator.m:
compiler/instmap.m:
compiler/mercury_to_mercury.m:
compiler/modecheck_unify.m:
compiler/prog_io_pragma.m:
compiler/term_constr_initial.m:
compiler/term_pass1.m:
compiler/term_traversal.m:
compiler/term_util.m:
	Conform to the above changes.
This commit is contained in:
Julien Fischer
2007-08-27 06:22:16 +00:00
parent 55d8a88587
commit beeedc6e0d
15 changed files with 192 additions and 117 deletions

View File

@@ -30,7 +30,6 @@
:- import_module bool.
:- import_module io.
:- import_module list.
:- import_module pair.
:- import_module set.
%-----------------------------------------------------------------------------%
@@ -39,7 +38,9 @@
---> disj
; if_then_else.
:- type merge_error == pair(prog_var, list(mer_inst)).
:- type merge_error
---> merge_error(prog_var, list(mer_inst)).
:- type merge_errors == list(merge_error).
:- type delayed_goal
@@ -245,6 +246,7 @@
:- import_module int.
:- import_module map.
:- import_module maybe.
:- import_module pair.
:- import_module string.
:- import_module term.
:- import_module varset.
@@ -526,7 +528,8 @@ mode_error_par_conj_to_spec(ModeInfo, ErrorList) = Spec :-
:- func merge_error_to_pieces(mode_info, merge_error) = list(format_component).
merge_error_to_pieces(ModeInfo, Var - Insts) = Pieces :-
merge_error_to_pieces(ModeInfo, MergeError) = Pieces :-
MergeError = merge_error(Var, Insts),
mode_info_get_varset(ModeInfo, VarSet),
Pieces = [words(add_quotes(mercury_var_to_string(VarSet, no, Var))),
fixed("::"),