for review: type class error messages tests

David Glen JEFFERY dgj at cs.mu.OZ.AU
Tue Sep 22 15:55:27 AEST 1998


Hi,

Here's the test cases for my previous diff (which doesn't seem to have 
appeared yet):

------------------------------------------------------------------------------

Estimated hours taken: 0.2

Test cases for the type class error messages.

invalid/typeclass_test_[3,4].err_exp:
	Updated to use the new error message format.
invalid/Mmakefile:
	Turn on the new test case.
invalid/typeclass_test_5.m:
	New test case for unsatisfied superclass constraints and multiply
	defined instance methods.

cvs diff: Diffing .
Index: Mmakefile
===================================================================
RCS file: /home/staff/zs/imp/tests/invalid/Mmakefile,v
retrieving revision 1.20
diff -u -t -r1.20 Mmakefile
--- Mmakefile	1998/06/24 15:26:49	1.20
+++ Mmakefile	1998/09/22 05:46:37
@@ -46,6 +46,7 @@
         typeclass_test_2.m \
         typeclass_test_3.m \
         typeclass_test_4.m \
+        typeclass_test_5.m \
         unbound_inst_var.m \
         undef_lambda_mode.m \
         undef_mode.m \
Index: typeclass_test_3.err_exp
===================================================================
RCS file: /home/staff/zs/imp/tests/invalid/typeclass_test_3.err_exp,v
retrieving revision 1.4
diff -u -t -r1.4 typeclass_test_3.err_exp
--- typeclass_test_3.err_exp	1998/06/16 03:16:49	1.4
+++ typeclass_test_3.err_exp	1998/09/22 05:47:50
@@ -1,2 +1,5 @@
-No implementation for type class method typeclass_test_3:type_num/2
+typeclass_test_3.m:014: In instance declaration for
+typeclass_test_3.m:014:   typeclass_test_3:numbered_type(int), no
+typeclass_test_3.m:014:   implementation for type class method
+typeclass_test_3.m:014:   typeclass_test_3:type_num/2.
 For more information, try recompiling with `-E'.
Index: typeclass_test_4.err_exp
===================================================================
RCS file: /home/staff/zs/imp/tests/invalid/typeclass_test_4.err_exp,v
retrieving revision 1.2
diff -u -t -r1.2 typeclass_test_4.err_exp
--- typeclass_test_4.err_exp	1998/06/16 03:16:50	1.2
+++ typeclass_test_4.err_exp	1998/09/22 05:48:22
@@ -1,2 +1,5 @@
-No implementation for type class method typeclass_test_4:type_num/2
+typeclass_test_4.m:014: In instance declaration for
+typeclass_test_4.m:014:   typeclass_test_4:numbered_type(int), no
+typeclass_test_4.m:014:   implementation for type class method
+typeclass_test_4.m:014:   typeclass_test_4:type_num/2.
 For more information, try recompiling with `-E'.
===================================================================

New file: invalid/typeclass_test_5.m:

:- module typeclass_test_5.

:- interface.

:- import_module io.

:- pred main(io__state::di, io__state::uo) is det.

:- typeclass c1(T) where [].
:- typeclass c2(T) <= c1(T) where [ 
	pred p(T), mode p(out) is det
].

:- instance c2(int) where [
	pred(p/1) is get_int,
	pred(p/1) is get_int2
].

:- pred get_int(int::out) is det.
:- pred get_int2(int::out) is det.

:- implementation.

main --> [].

get_int(42).
get_int2(43).


===================================================================

New file: invalid/typeclass_test_5.err_exp:

typeclass_test_5.m:015: In instance declaration for typeclass_test_5:c2(int),
typeclass_test_5.m:015:   multiple implementations of type class method
typeclass_test_5.m:015:   typeclass_test_5:p/1.
typeclass_test_5.m:016: First definition appears here.
typeclass_test_5.m:017: Subsequent definition appears here.
typeclass_test_5.m:015: In instance declaration for typeclass_test_5:c2(int),
typeclass_test_5.m:015:   superclass constraint(s) not satisfied:
typeclass_test_5.m:015:   typeclass_test_5:c1(int).
For more information, try recompiling with `-E'.
------------------------------------------------------------------------------


dgj
-- 
David Jeffery (dgj at cs.mu.oz.au) |  Marge: Did you just call everyone "chicken"?
PhD student,                    |  Homer: Noooo.  I swear on this Bible!
Department of Computer Science  |  Marge: That's not a Bible; that's a book of
University of Melbourne         |         carpet samples!
Australia                       |  Homer: Ooooh... Fuzzy.



More information about the developers mailing list