[m-rev.] diff: fix bug with type classes & pragma c_code
Fergus Henderson
fjh at cs.mu.OZ.AU
Mon Aug 6 14:04:05 AEST 2001
My change to library/store.m happened to trigger a compiler bug...
hence the fix below. I'm currently running a bootcheck, and I'll
commit both this change and the one to library/store.m if the bootcheck passes.
----------
Estimated hours taken: 2
Branches: main
compiler/polymorphism.m:
Fix a bug in the handling of pragma c_code / foreign_proc: in
the case where the procedure had both type class constraints
and unconstrained type variables, it was getting the arguments
in the wrong order.
Workspace: /home/venus/fjh/ws-venus4/mercury
Index: compiler/polymorphism.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/polymorphism.m,v
retrieving revision 1.216
diff -u -d -r1.216 polymorphism.m
--- compiler/polymorphism.m 31 Jul 2001 14:29:50 -0000 1.216
+++ compiler/polymorphism.m 6 Aug 2001 03:50:38 -0000
@@ -1634,11 +1634,22 @@
require(unify(NEVs, NumExtraVars),
"list length mismatch in polymorphism processing pragma_c"),
- polymorphism__c_code_add_typeinfos(
- PredTypeVars, PredTypeVarSet, ExistQVars, Impl,
- ArgInfo0, ArgInfo1),
+% The argument order is as follows:
+% first the UnivTypeInfos (for universally quantified type variables)
+% then the ExistTypeInfos (for existentially quantified type variables)
+% then the UnivTypeClassInfos (for universally quantified constraints)
+% then the ExistTypeClassInfos (for existentially quantified constraints)
+% and finally the original arguments of the predicate.
+%
+% But since we're building ArgInfo by starting with the original
+% arguments and prepending things as we go, we need to do it in
+% reverse order.
+
polymorphism__c_code_add_typeclass_infos(
UnivCs, ExistCs, PredTypeVarSet, Impl,
+ ArgInfo0, ArgInfo1),
+ polymorphism__c_code_add_typeinfos(
+ PredTypeVars, PredTypeVarSet, ExistQVars, Impl,
ArgInfo1, ArgInfo),
%
--
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