Files
mercury/tests/valid/lambda_quant.m
Fergus Henderson f4e0523e03 Fix a couple of bugs in the handling of implicit quantification
for variables in lambda goals.

compiler/quantification.m:
	(1) When implicitly-quantifying a lambda goal, the "lambda-outsidevars"
	    should be set to the empty set, so that variables occurring
	    only inside disjoint lambda goals are locally quantified
	    inside those lambda goals.
	(2) When quantifying conjunctions and if-then-elses, use both
	    the lambda outsidevars and the ordinary outsidevars when
	    computing the non-locals, rather than just using the
	    ordinary outsidevars.

tests/valid/lambda_quant.m:
	Add another test case for bug (1).
	There was already a tests in this module that was supposed to
	test this sort of stuff, but that test case happened to work,
	because the effects of bugs (1) and (2) cancelled out. :-(

tests/valid/Mmake:
tests/valid/lambda_quant_bug.m:
	Add a regression test for bug (2).
1997-07-12 17:52:43 +00:00

30 lines
627 B
Mathematica

% Test quantification of local variables in lambda expressions.
% Also test use of variables as goals (without *explicitly* using call/1).
:- module lambda_quant.
:- interface.
:- pred test(pred).
:- mode test(out((pred) is semidet)) is nondet.
:- implementation.
:- import_module list, int.
:- pred t is semidet.
t.
:- pred f is semidet.
f :- fail.
test(t).
test(f).
test(G) :-
G1 = ((pred) is semidet :- X = 0, X \= 1),
G2 = ((pred) is det :- X = [], X \= [_|_]),
G = ((pred) is semidet :- G1, G2).
test(G) :-
G1 = ((pred) is semidet :- Y = 0),
G2 = ((pred) is det :- Y = []),
G = ((pred) is semidet :- G1, G2).