for review: context reduction on overloaded calls
David Glen JEFFERY
dgj at cs.mu.OZ.AU
Thu Feb 5 15:49:40 AEDT 1998
Hi,
This diff fixes a bug for overloaded predicates with class contexts. Context
reduction was not being done, resulting in spurious unsatisfied typeclass
constraint errors. (Test case to follow once I've cut down the huge case that
I've got).
Estimated hours taken: 4
compiler/typecheck.m:
Move the call to perform_context_reduction out of the if-then-else so
that it gets executed even in the presence of overloading.
Index: typecheck.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/typecheck.m,v
retrieving revision 1.229
diff -u -r1.229 typecheck.m
--- typecheck.m 1998/02/03 07:03:15 1.229
+++ typecheck.m 1998/02/05 04:41:07
@@ -912,18 +912,13 @@
Args, PredTypeVarSet, PredArgTypes,
PredClassContext,
TypeCheckInfo1, TypeCheckInfo2)
- ),
- % Arguably, we could do context reduction at
- % a different point. See the paper:
- % "Type classes: an exploration of the design
- % space", S.P. Jones, M. Jones 1997.
- % for a discussion of some of the issues.
- perform_context_reduction(TypeCheckInfo2, TypeCheckInfo)
+ )
;
typecheck_info_get_pred_import_status(TypeCheckInfo1,
CallingStatus),
typecheck_call_overloaded_pred(PredIdList, Args,
- CallingStatus, TypeCheckInfo1, TypeCheckInfo),
+ CallingStatus, TypeCheckInfo1, TypeCheckInfo2),
+
%
% In general, we can't figure out which
% predicate it is until after we have
@@ -936,7 +931,15 @@
% available to determine which predicate it is.
%
invalid_pred_id(PredId)
- )
+ ),
+
+ % Arguably, we could do context reduction at
+ % a different point. See the paper:
+ % "Type classes: an exploration of the design
+ % space", S.P. Jones, M. Jones 1997.
+ % for a discussion of some of the issues.
+ perform_context_reduction(TypeCheckInfo2, TypeCheckInfo)
+
;
invalid_pred_id(PredId),
report_pred_call_error(TypeCheckInfo1, ModuleInfo,
cvs diff: Diffing notes
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