[m-dev.] Re: Reminder: Mercury tests failing

Fergus Henderson fjh at cs.mu.OZ.AU
Sat May 31 02:04:23 AEST 2003

On 30-May-2003, David Overton <dmo at cs.mu.OZ.AU> wrote:
> From memory, I think the bug in pred_inst_matches* made it too
> conservative.

I think you're right.

Looking at the diffs, the bug I'm talking about was introduced in
revision 1.46 of inst_match.m.  Prior to that, higher-order insts
were matched contravariantly in the initial insts
(and covariantly in the final insts, of course).
But your change broke that.

Here's a better test case.  This example program compiles fine with
Mercury 0.9.1, but gets rejected by 0.10, 0.11, and the current compiler.
It ought to be allowed.

	:- module bug2.
	:- interface.
	:- import_module io.
	:- pred main(io__state::di, io__state::uo) is det.
	:- implementation.
	:- import_module list, bool.
	main -->
		( { q(p) } ->
			print("yes"), nl
			print("no"), nl
	:- type intlist == list(int).
	:- inst nonempty ---> [ground|list].
	:- inst list ---> [ground|list] ; [].
	:- pred p(intlist, intlist).
	:- mode p((list -> nonempty), (free -> nonempty)) is semidet.
	p([X], [X]).
	p([X,Y|Zs], [Y,X|Zs]).
	:- pred q(pred(intlist, intlist)).
	:- mode q(pred((nonempty -> nonempty), (free -> list)) is semidet)
		is semidet.
	q(P) :- P([1], L), L \= [].

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