[m-rev.] diff: new ambiguity test case

Zoltan Somogyi zs at csse.unimelb.edu.au
Thu Dec 11 11:54:16 AEDT 2008


tests/valid/ambiguity_stress_test.m:
	Add this test case, contributed by Michael Day.

tests/valid/Mmakefile:
	List the test case, but don't enable it, since we don't now pass it.

Zoltan.

cvs diff: Diffing .
Index: Mmakefile
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/valid/Mmakefile,v
retrieving revision 1.222
diff -u -b -r1.222 Mmakefile
--- Mmakefile	1 Dec 2008 00:32:57 -0000	1.222
+++ Mmakefile	11 Dec 2008 00:46:09 -0000
@@ -287,6 +287,9 @@
 RESERVE_TAG_PROGS = \
 	reserve_tag
 
+# XXX The type checker can't handle the following test cases yet:
+#	ambiguity_stress_test
+#
 # XXX The mode system can't handle the following test cases yet:
 #	assoc_list_bug
 #	determinism
Index: ambiguity_stress_test.m
===================================================================
RCS file: ambiguity_stress_test.m
diff -N ambiguity_stress_test.m
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ambiguity_stress_test.m	11 Dec 2008 00:49:06 -0000
@@ -0,0 +1,108 @@
+% This test case was contributed by Michael Day.
+%
+% With the current typechecker, this module generates roughly 35 million type
+% assignments, which is far too many. To handle it, you need a constraint based
+% type analysis algorithm.
+
+:- module ambiguity_stress_test.
+
+:- interface.
+
+:- type a ---> foo ; bar.
+:- type b ---> foo ; bar.
+:- type c ---> foo ; bar.
+:- type d ---> foo ; bar.
+:- type e ---> foo ; bar.
+:- type f ---> foo ; bar.
+:- type g ---> foo ; bar.
+:- type h ---> foo ; bar.
+:- type i ---> foo ; bar.
+:- type j ---> foo ; bar.
+:- type k ---> foo ; bar.
+:- type l ---> foo ; bar.
+:- type m ---> foo ; bar.
+:- type n ---> foo ; bar.
+:- type o ---> foo ; bar.
+:- type p ---> foo ; bar.
+:- type q ---> foo ; bar.
+:- type r ---> foo ; bar.
+:- type s ---> foo ; bar.
+:- type t ---> foo ; bar.
+:- type u ---> foo ; bar.
+:- type v ---> foo ; bar.
+:- type w ---> foo ; bar.
+:- type x ---> foo ; bar.
+:- type y ---> foo ; bar.
+:- type z ---> foo ; bar.
+:- type a2 ---> foo ; bar.
+:- type b2 ---> foo ; bar.
+:- type c2 ---> foo ; bar.
+:- type d2 ---> foo ; bar.
+:- type e2 ---> foo ; bar.
+:- type f2 ---> foo ; bar.
+:- type g2 ---> foo ; bar.
+:- type h2 ---> foo ; bar.
+:- type i2 ---> foo ; bar.
+:- type j2 ---> foo ; bar.
+:- type k2 ---> foo ; bar.
+:- type l2 ---> foo ; bar.
+:- type m2 ---> foo ; bar.
+:- type n2 ---> foo ; bar.
+:- type o2 ---> foo ; bar.
+:- type p2 ---> foo ; bar.
+:- type q2 ---> foo ; bar.
+:- type r2 ---> foo ; bar.
+:- type s2 ---> foo ; bar.
+:- type t2 ---> foo ; bar.
+:- type u2 ---> foo ; bar.
+:- type v2 ---> foo ; bar.
+:- type w2 ---> foo ; bar.
+:- type x2 ---> foo ; bar.
+:- type y2 ---> foo ; bar.
+:- type z2 ---> foo ; bar.
+:- type a3 ---> foo ; bar.
+:- type b3 ---> foo ; bar.
+:- type c3 ---> foo ; bar.
+:- type d3 ---> foo ; bar.
+:- type e3 ---> foo ; bar.
+:- type f3 ---> foo ; bar.
+:- type g3 ---> foo ; bar.
+:- type h3 ---> foo ; bar.
+:- type i3 ---> foo ; bar.
+:- type j3 ---> foo ; bar.
+:- type k3 ---> foo ; bar.
+:- type l3 ---> foo ; bar.
+:- type m3 ---> foo ; bar.
+:- type n3 ---> foo ; bar.
+:- type o3 ---> foo ; bar.
+:- type p3 ---> foo ; bar.
+:- type q3 ---> foo ; bar.
+:- type r3 ---> foo ; bar.
+:- type s3 ---> foo ; bar.
+:- type t3 ---> foo ; bar.
+:- type u3 ---> foo ; bar.
+:- type v3 ---> foo ; bar.
+:- type w3 ---> foo ; bar.
+:- type x3 ---> foo ; bar.
+:- type y3 ---> foo ; bar.
+:- type z3 ---> foo ; bar.
+
+:- pred ambig(a, a, a, a).
+:- mode ambig(out, out, out, out) is det.
+
+:- implementation.
+
+ambig(A1, A2, A3, A4) :-
+    X1 = foo,
+    X2 = foo,
+    X3 = foo,
+    X4 = foo,
+    constrain(X1, A1),
+    constrain(X2, A2),
+    constrain(X3, A3),
+    constrain(X4, A4).
+
+:- pred constrain(a, a).
+:- mode constrain(in, out) is det.
+
+constrain(A, A).
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to:       mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions:          mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the reviews mailing list