[m-dev.] diff: begin using functionality from error_util in typecheck.m

Fergus Henderson fjh at cs.mu.OZ.AU
Thu Feb 10 18:03:36 AEDT 2000


On 10-Feb-2000, Robert Ernst Johann JESCHOFNIK <rejj at students.cs.mu.oz.au> wrote:
> +++ typecheck.m	2000/01/27 03:09:45
> @@ -4500,10 +4500,14 @@
>  
>  report_error_no_clauses(PredId, PredInfo, ModuleInfo) -->
>  	{ pred_info_context(PredInfo, Context) },
> -	prog_out__write_context(Context),
> -	io__write_string("Error: no clauses for "),
> -	hlds_out__write_pred_id(ModuleInfo, PredId),
> -	io__write_string(".\n").
> +	{ error_util__describe_one_pred_name(ModuleInfo, PredId, PredName) },
> +	{ ErrorMsg0 = [ "Error: no clauses for ", PredName, "." ] },
> +	{ error_util__list_to_pieces(ErrorMsg0, ErrorMsg) },
> +	error_util__write_error_pieces(Context, 0, ErrorMsg).
> +	% prog_out__write_context(Context),
> +	% io__write_string("Error: no clauses for "),
> +	% hlds_out__write_pred_id(ModuleInfo, PredId),
> +	% io__write_string(".\n").

You should just delete the old code, rather than leaving it commented out.
Leaving it there doesn't really add anything to the readability of the code.
(If people want to look at the old code, that is what cvs is for...)

>  %-----------------------------------------------------------------------------%
>  
> @@ -4514,22 +4518,33 @@
>  
>  report_warning_too_much_overloading(TypeCheckInfo) -->
>  	{ typecheck_info_get_context(TypeCheckInfo, Context) },
> -	write_context_and_pred_id(TypeCheckInfo),
> -	prog_out__write_context(Context),
> -	report_warning("  warning: highly ambiguous overloading.\n"),
> +	{ make_pred_id_preamble(TypeCheckInfo, Preamble) },
> +	%write_context_and_pred_id(TypeCheckInfo),
> +	%prog_out__write_context(Context),
> +	%report_warning("  warning: highly ambiguous overloading.\n"),
> +	{ SmallWarning = [ Preamble,
> +				"warning: highly ambiguous overloading." ] },
>  	globals__io_lookup_bool_option(verbose_errors, VerboseErrors),
>  	( { VerboseErrors = yes } ->
> -		prog_out__write_context(Context),
> -		io__write_string(
> -		    "  This may cause type-checking to be very slow.\n"
> -		),
> -		prog_out__write_context(Context),
> -		io__write_string(
> -		    "  It may also make your code difficult to understand.\n"
> -		)
> -	;
> -		[]
> -	).
> +		%prog_out__write_context(Context),
> +		%io__write_string(
> +		%    "  This may cause type-checking to be very slow.\n"
> +		%),
> +		%prog_out__write_context(Context),
> +		%io__write_string(
> +		%    "  It may also make your code difficult to understand.\n"
> +		%)
> +		{ VerboseWarning = [ "This may cause type-checking to be very",
> +					"slow. It may also make your code",
> +					"difficult to understand." ] },
> +		{ list__append(SmallWarning, VerboseWarning, Warning0) }
> +	;
> +		%[]
> +		{ Warning0 = SmallWarning }
> +	%).
> +	),
> +	{ error_util__list_to_pieces(Warning0, Warning) },
> +	error_util__report_warning(Context, 0, Warning).

Likewise there.

> +	% This is intended to superceed the above predicate - It performs the

s/superceed/supercede/

> +	% The string generated by this predicate is of the form:
> +	%   "In clause for module:pred/N :"

s/N :/N:/
   ^

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3        |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list