Files
mercury/tests/valid/some_switch.m
Fergus Henderson f3b7548ac4 Fix a problem reported by Baudouin Le Charlier <ble@info.fundp.ac.be>
where switch detection was getting confused by explicit existential
quantifications.

compiler/switch_detection.m:
	When detecting switches, traverse through some/2 goals.
	Also simplify the code a bit.

tests/valid/Mmakefile:
tests/valid/some_switch.m:
	Regression test for the above change.
1998-05-12 17:05:06 +00:00

19 lines
402 B
Mathematica

% Test of switch detection with explicit existential quantification.
:- module some_switch.
:- interface.
:- type nat ---> o ; s(nat).
:- func add(nat,nat) = nat.
:- mode add(in,in) = in is semidet.
:- mode add(out,out) = in is multi.
:- mode add(in,in) = out is det.
:- implementation.
add(X,Y) = Z :-
( ( X=o , Z=Y ) ;
some [Xp] ( X=s(Xp), Z=s(add(Xp,Y)) ) ).