[m-dev.] for review: fix det inference bug for unifications

Fergus Henderson fjh at cs.mu.OZ.AU
Wed Jun 23 13:58:08 AEST 1999


On 23-Jun-1999, Peter Ross <petdr at cs.mu.OZ.AU> wrote:
> Fix bug where unification of two variables with identical bound inst
> lists were incorrectly being inferred det.
...
> mercury/compiler/inst_util.m:
>     Handle bound inst lists of length > 1 correctly.
...
> +++ inst_util.m	1999/06/22 05:30:09
> @@ -517,7 +517,7 @@
>  abstractly_unify_bound_inst_list(Live, Xs, Ys, Real, ModuleInfo0, L, Det,
>  		ModuleInfo) :-
>  	abstractly_unify_bound_inst_list_2(Live, Xs, Ys, Real,
> -		ModuleInfo0, L, Det0, ModuleInfo),
> +		ModuleInfo0, 0, L, Det0, ModuleInfo),
>  	( L = [] ->
>  		det_par_conjunction_detism(Det0, erroneous, Det)
>  	;
> @@ -525,24 +525,34 @@
...
> +abstractly_unify_bound_inst_list_2(_, [], [], _, ModuleInfo, N, [], Det,
> +		ModuleInfo) :-
> +	(
> +			% The only time an abstract unification should
> +			% be det, is when both of the bound_inst lists
> +			% are of length one and have the same cons_ids.
> +		N = 1
> +	->
> +		Det = det
> +	;
> +		Det = semidet
> +	).

When N < 1, you need Det = det, otherwise the call to
det_para_conjunction_detism will incorrect infer Det = failure
rather than Det = erroneous.  So you need to change the N = 1 test
to N =< 1.

Otherwise that looks great, thanks.

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