[m-rev.] for review: typecheck error message simplification

Fergus Henderson fjh at cs.mu.OZ.AU
Mon Jul 23 21:36:20 AEST 2001


On 23-Jul-2001, Zoltan Somogyi <zs at cs.mu.OZ.AU> wrote:
> compiler/typecheck.m:
> 	Avoid the output of error messages of the form
> 	"variable X has overloaded type { T, T, T, T}"
> 	Instead, simply report that X has type T.
...
>  write_type_of_var(_TypeCheckInfo, TypeAssignSet, Var) -->
>  	{ get_type_stuff(TypeAssignSet, Var, TypeStuffList) },
> -	( { TypeStuffList = [SingleTypeStuff] } ->
> -		{ SingleTypeStuff = type_stuff(VType, TVarSet, TBinding) },
> +	(
> +		{ TypeStuffList = [ExampleTypeStuff | _] },
> +		{ list__all_same(TypeStuffList) }
> +	->
> +		{ ExampleTypeStuff = type_stuff(VType, TVarSet, TBinding) },
>  		io__write_string(" has type `"),
>  		write_type_b(VType, TVarSet, TBinding),
>  		io__write_string("'")

I don't think that is safe -- I think you need to apply the type bindings
before doing the test for the values being the same.  Otherwise you might
get some false hits.

-- 
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