diff: fix to typeclass interface files

David Glen JEFFERY dgj at cs.mu.OZ.AU
Wed Jan 21 16:37:21 AEDT 1998


Hi,

Here's a small diff (which I've already commited), which fixes some bugs in
the code generated in interface files for typeclass stuff.



Estimated hours taken: 1/4


compiler/mercury_to_mercury.m:
	Fix a syntax error in interface files. Do not put the ":-" at the
	start of mode declarations for class methods.
compiler/prog_io_typeclass.m:
	Ignore the module qualifier when checking that the type in an instance
	declaration is a functor with vars as args.


cvs diff: Diffing .
Index: mercury_to_mercury.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/mercury_to_mercury.m,v
retrieving revision 1.127
diff -u -r1.127 mercury_to_mercury.m
--- mercury_to_mercury.m	1998/01/14 00:21:09	1.127
+++ mercury_to_mercury.m	1998/01/21 04:56:30
@@ -445,12 +445,12 @@
 		{ Method = pred_mode(VarSet, Name, Modes, Detism, 
 			_Condition, Context) },
 		mercury_output_pred_mode_decl_2(VarSet, Name, Modes, Detism,
-			Context, ":- ", "\n")
+			Context, "", "\n")
 	;
 		{ Method = func_mode(VarSet, Name, Modes, Mode, 
 			Detism, _Condition, Context) },
 		mercury_output_func_mode_decl_2(VarSet, Name, Modes, 
-			Mode, Detism, Context, ":- ", "\n")
+			Mode, Detism, Context, "", "\n")
 	),
 	io__write_char(')').
 
Index: prog_io_typeclass.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/prog_io_typeclass.m,v
retrieving revision 1.3
diff -u -r1.3 prog_io_typeclass.m
--- prog_io_typeclass.m	1998/01/13 10:03:48	1.3
+++ prog_io_typeclass.m	1998/01/21 05:17:22
@@ -371,13 +371,28 @@
 		IsFunctorAndVarArgs = lambda([Type::in] is semidet,
 			(
 					% Is the top level functor an atom?
-				Type = term__functor(term__atom(_), Args, _),
-					% Are all the args of the functor
-					% variables?
-				list__map(
-					lambda([A::in, B::out] is semidet, 
-						type_util__var(A,B)), 
-					Args, _)
+				Type = term__functor(term__atom(Functor), 
+						Args, _),
+				(
+					Functor = ":"
+				->
+					Args = [_Module, Type1],
+						% Is the top level functor an
+						% atom?
+					Type1 = term__functor(term__atom(_), 
+							Args1, _),
+						% Are all the args of the
+						% functor variables?
+					list__map(lambda([A::in, B::out] 
+							is semidet, 
+						type_util__var(A,B)), Args1, _)
+				;
+						% Are all the args of the
+						% functor variables?
+					list__map(lambda([A::in, B::out] 
+							is semidet, 
+						type_util__var(A,B)), Args, _)
+				)
 			)),
 		list__filter(IsFunctorAndVarArgs, TermTypes, _,
 			ErroneousTypes),
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