[m-dev.] for review: better messages for some type errors

Fergus Henderson fjh at cs.mu.oz.au
Mon Oct 13 19:39:49 AEST 1997


Zoltan Somogyi, you wrote:
> 
> --- typecheck.m	1997/09/29 06:12:40	1.215
> +++ typecheck.m	1997/10/13 08:30:43
> @@ -3112,15 +3112,95 @@
>  
>  	% XXX we should print type pairs (one type from each side)
>  	% only for the arguments in which the two types differ.

You should rewrite that comment now.

> +	(
> +		(
> +			FullArgType = ExpType
> +		;
> +			FullArgType = term__functor(term__atom("<any>"), [], _)
> +		)
> +	->
> +		Mismatched = Mismatched1
> +	;
> +		Mismatched = [mismatch(ArgNum0, Arg, FullArgType, ArgVarSet,
> +			ExpType, ExpTVarSet) | Mismatched1]
> +	).

Some documentation here would be helpful.

The condition of the if-then-else is wrong --
in particular, the test `FullArgType = ExpType'
may fail if the term__contexts in the types don't match.
You need to use the `identical_types' predicate in typecheck.m.

Otherwise that looks fine.

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



More information about the developers mailing list