[m-rev.] for review: better error messages for overloaded types

Fergus Henderson fjh at cs.mu.OZ.AU
Mon Aug 6 17:48:43 AEST 2001


On 06-Aug-2001, Zoltan Somogyi <zs at cs.mu.OZ.AU> wrote:
> On 03-Aug-2001, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> > For consistency with other error messages,
> > the types should be intended two spaces more than the "variable ... has
> > overloaded type" message, rather than just one space more.
> > Also the closing '}' should be intended at the same level as the "variable
> > ... has overloaded type" message, rather than one space more.
> > 
> > i.e. it should be
> > 
> > overloading.m:050:   variable `StartMap0' has overloaded type {
> > overloading.m:050:     (pred (tree234:tree234(V_V_1, V_V_2))),
> > overloading.m:050:     (tree234:tree234(K, V))
> > overloading.m:050:   },
> > 
> > 
> > Otherwise that looks fine.  Please post a relative diff.
> 
> I have followed your other suggestions, but I am not sure about what should be
> done here.

Specifically, in typecheck.m where you've added

	write_types_list(Context, [Type | Types]) -->
	       prog_out__write_context(Context),
	       io__write_string("   "),

do s/"   "/"    "/
(output four spaces rather than three),
and in write_type_of_var, change

		io__write_string(" }")  

to

		io__write_string("}")  

> I think the code that prints the first line of the error message
> (which I did not change) is already wrong, because it has two spaces, not one.

Two is correct.  `prog_out__write_context' writes out "file.m:1234:"
followed by one space, and the idea is that any lines after the first
in an error message are indented by an additional two spaces.  If you
want to indent things another level, then it should be intended another
two spaces (making a total of four, not counting the one output by
prog_out__write_context).

(Also, extended error descriptions for --verbose-errors are output with
a single tab indentation, instead of prog_out__write_context.)

> It seems the rest of this module does not follow the convention.

All the code currently in typecheck.m does follow the convention described
in my previous paragraph.  `report_error_var' and `report_error_arg_var'
are examples of code which indents things two levels (four spaces).

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
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