[m-rev.] for review: show existential quantifiers in type error messages

Fergus Henderson fjh at cs.mu.OZ.AU
Mon Feb 11 21:28:43 AEDT 2002


On 07-Feb-2002, Zoltan Somogyi <zs at cs.mu.OZ.AU> wrote:
> On 06-Feb-2002, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> > Improve the error messages for type errors involving existentially quantified
> > types.
> 
> The diff looks OK. However, it would be nice if you added a test case for
> the "erroneous error" in which more than clause computes an existentially
> typed argument.

Done.  I'll commit this change with the following addition.

tests/invalid/Mmakefile:
tests/invalid/ext_type.m:
tests/invalid/ext_type.err_exp:
	A new test case to test that different occurrences of existentially
	quantified variables can't be unified.

Index: tests/invalid/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/tests/invalid/Mmakefile,v
retrieving revision 1.101
diff -u -d -r1.101 Mmakefile
--- tests/invalid/Mmakefile	15 Nov 2001 13:32:48 -0000	1.101
+++ tests/invalid/Mmakefile	11 Feb 2002 10:22:17 -0000
@@ -45,6 +45,7 @@
 	errors1.m \
 	errors2.m \
 	external.m \
+	ext_type.m \
 	ext_type_bug.m \
 	exported_mode.m \
 	field_syntax_error.m \
Index: tests/invalid/ext_type.err_exp
===================================================================
RCS file: tests/invalid/ext_type.err_exp
diff -N tests/invalid/ext_type.err_exp
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/invalid/ext_type.err_exp	11 Feb 2002 10:21:52 -0000
@@ -0,0 +1,13 @@
+ext_type.m:016: In clause for predicate `ext_type:p/2':
+ext_type.m:016:   type error in unification of variable `Z'
+ext_type.m:016:   and functor `q/1'.
+ext_type.m:016:   variable `Z' has type `(some [QT] QT)',
+ext_type.m:016:   functor `q/1' has type 
+ext_type.m:016:   `q(int) :: (some [QT] QT)'.
+ext_type.m:019: In clause for predicate `ext_type:r/0':
+ext_type.m:019:   type error in unification of argument
+ext_type.m:019:   and functor `q/1'.
+ext_type.m:019:   argument has type `(some [QT] QT)',
+ext_type.m:019:   functor `q/1' has type 
+ext_type.m:019:   `q(int) :: (some [QT] QT)'.
+For more information, try recompiling with `-E'.
Index: tests/invalid/ext_type.m
===================================================================
RCS file: tests/invalid/ext_type.m
diff -N tests/invalid/ext_type.m
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/invalid/ext_type.m	11 Feb 2002 10:21:30 -0000
@@ -0,0 +1,23 @@
+:- module ext_type.
+
+:- interface.
+:- import_module bool.
+
+:- some [PT] pred p(bool, PT).
+:- mode p(in, out) is det.
+
+:- pred r is semidet.
+
+:- implementation.
+
+p(yes, Y) :-
+	Y = q(42).
+p(no, Z) :-
+	Z = q(43).
+
+r :-
+	q(1) = q(2).
+
+:- some [QT] func q(int) = QT.
+q(X) = X.
+

-- 
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-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list