diff: another bug fix

David Glen JEFFERY dgj at cs.mu.OZ.AU
Thu Jun 18 16:17:51 AEST 1998


Hi Fergus,

Can you please review this? (With the test case... it's actually the same test
case that I posted last time... it tickled this bug. I committed a slightly
different version which did not tickle the bug last time).


Estimated hours taken: 1.5

compiler/polymorphism.m:
	When building the type-infos to be packaged inside a typeclass-info,
	apply the variable type bindings first.

tests/valid/instance_unconstrained_tvar.m:
	Test case for this.
tests/valid/Mmakefile:
	Turn this test on. Also turn another test on which I mistakenly
	turned off in my previous commit (because the test was failing).

Index: polymorphism.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/polymorphism.m,v
retrieving revision 1.137
diff -u -t -r1.137 polymorphism.m
--- polymorphism.m	1998/06/18 03:51:04	1.137
+++ polymorphism.m	1998/06/18 05:55:41
@@ -1259,8 +1259,11 @@
                                         % Make the type_infos for the types
                                         % that are constrained by this. These
                                         % are packaged in the typeclass_info
+                                term__apply_substitution_to_list(
+                                        ConstrainedTypes, VarTypes0,
+                                        RenamedConstrainedTypes),
                                 polymorphism__make_type_info_vars(
-                                        ConstrainedTypes,
+                                        RenamedConstrainedTypes,
                                         InstanceExtraTypeInfoVars,
                                         TypeInfoGoals,
                                         Info0, Info1),

cvs diff: Diffing .
Index: Mmakefile
===================================================================
RCS file: /home/staff/zs/imp/tests/valid/Mmakefile,v
retrieving revision 1.18
diff -u -t -r1.18 Mmakefile
--- Mmakefile	1998/06/18 04:11:43	1.18
+++ Mmakefile	1998/06/18 06:14:07
@@ -32,6 +32,7 @@
         explicit_quant.m \
         fail_ite.m \
         followcode_det_problem.m \
+        func_int_bug_main.m \
         headvar_not_found.m \
         higher_order.m \
         higher_order2.m \
@@ -44,6 +45,7 @@
         inhibit_warn_test.m \
         inlining_bug.m \
         instance_superclass.m \
+        instance_unconstrained_tvar.m \
         intermod_lambda.m \
         intermod_test.m \
         lambda_inference.m\


New file tests/valid/instance_unconstrained_tvar.m:
===================================================================

:- module instance_unconstrained_tvar.

:- interface.

:- import_module list.

:- typeclass c1(T) where [ ].
:- typeclass c2(T) <= c1(T) where [ ].

:- instance c1(list(T)) where [ ].
:- instance c2(list(T)) where [ ].

:- pred p is det.

:- implementation.

	% The bug that this test case is checking for is at the creation of
	% the typeclass info for this call, when creating the type-info the
	% the int (1), the type bindings were not being applied properly.
p :- q([1]).

:- pred q(T) <= c2(T).
:- mode q(in) is det.

q(_).




love and cuddles,
dgj
-- 
David Jeffery (dgj at cs.mu.oz.au) |  Marge: Did you just call everyone "chicken"?
MEngSc 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