for review: another existential types & .int files bug fix
Fergus Henderson
fjh at cs.mu.OZ.AU
Thu Sep 3 19:04:45 AEST 1998
DJ, can you please review this one?
compiler/mercury_to_mercury.m:
Fix yet another bug with incorrect parenthesization of
pred declarations involving existential types:
parentheses are needed if there are any existentially
typed variables _or_ if there are any existential constraints.
(The previous code used the first condition for the `('
and the second condition for the `)', resulting in unmatched
parentheses in the cases where these two conditions did
not agree.)
Index: compiler/mercury_to_mercury.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mercury_to_mercury.m,v
retrieving revision 1.143
diff -u -r1.143 mercury_to_mercury.m
--- mercury_to_mercury.m 1998/08/19 06:51:12 1.143
+++ mercury_to_mercury.m 1998/09/03 08:58:33
@@ -1292,7 +1292,7 @@
Purity, ClassContext, _Context, StartString, Separator) -->
io__write_string(StartString),
mercury_output_quantifier(VarSet, ExistQVars),
- ( { ExistQVars = [] } ->
+ ( { ExistQVars = [], ClassContext = context(_, []) } ->
[]
;
io__write_string("(")
@@ -1307,10 +1307,10 @@
mercury_output_term(Type, VarSet, no),
mercury_output_remaining_terms(Rest, VarSet, no),
io__write_string(")"),
- mercury_output_class_context(ClassContext, VarSet)
+ mercury_output_class_context(ClassContext, ExistQVars, VarSet)
;
mercury_output_bracketed_sym_name(PredName),
- mercury_output_class_context(ClassContext, VarSet),
+ mercury_output_class_context(ClassContext, ExistQVars, VarSet),
mercury_output_det_annotation(MaybeDet)
),
@@ -1385,7 +1385,7 @@
Separator) -->
io__write_string(StartString),
mercury_output_quantifier(VarSet, ExistQVars),
- ( { ExistQVars = [] } ->
+ ( { ExistQVars = [], ClassContext = context(_, []) } ->
[]
;
io__write_string("(")
@@ -1405,7 +1405,7 @@
),
io__write_string(" = "),
mercury_output_term(RetType, VarSet, no),
- mercury_output_class_context(ClassContext, VarSet),
+ mercury_output_class_context(ClassContext, ExistQVars, VarSet),
mercury_output_det_annotation(MaybeDet),
io__write_string(Separator).
@@ -1422,14 +1422,14 @@
%-----------------------------------------------------------------------------%
-:- pred mercury_output_class_context(class_constraints, varset,
+:- pred mercury_output_class_context(class_constraints, existq_tvars, varset,
io__state, io__state).
-:- mode mercury_output_class_context(in, in, di, uo) is det.
+:- mode mercury_output_class_context(in, in, in, di, uo) is det.
-mercury_output_class_context(ClassContext, VarSet) -->
+mercury_output_class_context(ClassContext, ExistQVars, VarSet) -->
{ ClassContext = constraints(UnivCs, ExistCs) },
mercury_output_class_constraint_list(ExistCs, VarSet, "&"),
- ( { ExistCs = [] } ->
+ ( { ExistQVars = [], ExistCs = [] } ->
[]
;
io__write_string(")")
--
Fergus Henderson <fjh at cs.mu.oz.au> | "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh> | of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3 | -- the last words of T. S. Garp.
More information about the developers
mailing list