diff: test case for modes abort

Simon Taylor stayl at cs.mu.OZ.AU
Thu Feb 12 12:03:59 AEDT 1998


Estimated hours taken: 0.1

tests/valid/higher_order.m
	Add a test case for an abort in mode analysis when 
	compiling with --deforestation (not yet committed),
	due to a predicate constant for a procedure with multiple
	modes.

Index: higher_order.m
===================================================================
RCS file: /home/staff/zs/imp/tests/valid/higher_order.m,v
retrieving revision 1.1
diff -u -r1.1 higher_order.m
--- higher_order.m	1995/11/14 08:03:29	1.1
+++ higher_order.m	1998/02/12 00:08:35
@@ -1,5 +1,17 @@
 :- module higher_order.
-:- import_module list, int.
+
+:- interface.
+:- import_module list.
+
+:- pred test(pred).
+:- mode test(out((pred) is semidet)) is multi.
+
+:- pred test(list(int), list(int)).
+:- mode test(in, out) is semidet.
+
+:- import_module int.
+
+:- implementation.
 
 :- pred map_list(pred(T1, T2), list(T1), list(T2)).
 :- mode map_list(pred(in, out) is det, in, out) is det.
@@ -11,12 +23,21 @@
 
 :- pred plus2(int, int).
 :- mode plus2(in, out) is det.
+:- mode plus2(out, in) is det.
 plus2(X, Y) :- Y is X + 2.
 
-:- pred test(list(int), list(int)).
-:- mode test(in, out) is det.
 test(L1, L2) :-
-	map_list(plus2, L1, L2).
+	test2(1, L1, L2).
+
+
+	% This test case an abort in mode analysis when compiling with
+	% --deforestation, since plus2 has multiple modes.
+:- pred test2(int::in, list(int)::in, list(int)::out) is semidet.
+
+test2(1, [L | L1], L3) :-
+	map_list(lambda([X::in, Y::out] is det, plus2(X, Y)), L1, L2),
+	test2(L, L2, L3).
+test2(2, L1, L1).
 
 :- pred t is semidet.
 t.
@@ -24,7 +45,5 @@
 :- pred f is semidet.
 f :- fail.
 
-:- pred test(pred).
-:- mode test(out((pred) is semidet)) is nondet.
 test(t).
 test(f).



More information about the developers mailing list