[m-dev.] diff: disable tests/invalid/typeclass_test_9.m

David Glen JEFFERY dgj at cs.mu.OZ.AU
Wed Oct 6 15:54:15 AEST 1999


On 03-Oct-1999, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> Hi,
> 
> DJ, your recent change to compiler/check_typeclass.m
> broke tests/invalid/typeclass_test_9.m.
> Could you please have a look at that?
> For now, I'm just going to disable the test case.

This diff addresses that bug.


Estimated hours taken: 3

compiler/check_typeclass.m:
	After creating the procs to go in the dictionary for an instance
	decl, check that:
		- there is one proc per proc in the typeclass inteface
		- we created on pred per entry in the instance interface.

tests/invalid/Mmakefile:
	Turn the typeclass_test_9 test on again. We now pass this test.

Index: check_typeclass.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/check_typeclass.m,v
retrieving revision 1.27
diff -u -t -r1.27 check_typeclass.m
--- check_typeclass.m	1999/09/29 05:21:16	1.27
+++ check_typeclass.m	1999/10/06 04:27:30
@@ -146,7 +146,7 @@
                 ModuleInfo1 = ModuleInfo0,
                 Errors2 = Errors0
         ;
-                InstanceBody = concrete(_Methods),
+                InstanceBody = concrete(InstanceMethods),
                 list__foldl2(
                         check_instance_pred(ClassId, Vars, ClassInterface), 
                         PredIds, InstanceDefn0, InstanceDefn1,
@@ -178,7 +178,17 @@
                                 _, MaybePredProcs, _, _),
                 (
                         MaybePredProcs = yes(PredProcs),
-                        list__same_length(PredProcs, ClassInterface)
+
+                                % Check that we wind with a procedure for each
+                                % proc in the type class interface.
+                        list__same_length(PredProcs, ClassInterface),
+
+                                % Check that we wind with a pred for each
+                                % pred in the instance class interface.
+                        list__map((pred(PP::in, P::out) is det :-
+                                PP = hlds_class_proc(P, _)), PredProcs, Preds0),
+                        list__remove_dups(Preds0, Preds),
+                        list__same_length(Preds, InstanceMethods)
                 ->
                         Errors2 = Errors1
                 ;


Index: ../tests/invalid/Mmakefile
===================================================================
RCS file: /home/staff/zs/imp/tests/invalid/Mmakefile,v
retrieving revision 1.50
diff -u -t -r1.50 Mmakefile
--- Mmakefile	1999/10/04 04:04:49	1.50
+++ Mmakefile	1999/10/06 05:50:03
@@ -60,6 +60,7 @@
         typeclass_test_4.m \
         typeclass_test_5.m \
         typeclass_test_7.m \
+        typeclass_test_9.m \
         types.m \
         type_spec.m \
         unbound_inst_var.m \
@@ -79,7 +80,6 @@
 #       typeclass_test_8.m (minor formatting error in the output --
 #                       the type class name should be in quotes;
 #                       also a software_error)
-#       typeclass_test_9.m (we don't catch all the errors that we should)
 
 MCFLAGS-aditi_update_errors =   --aditi
 MCFLAGS-aditi_update_mode_errors = --aditi


dgj
-- 
David Jeffery (dgj at cs.mu.oz.au) | If your thesis is utterly vacuous
PhD student,                    | Use first-order predicate calculus.
Dept. of Comp. Sci. & Soft. Eng.|     With sufficient formality
The University of Melbourne     |     The sheerist banality
Australia                       | Will be hailed by the critics: "Miraculous!"
                                |     -- Anon.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list