[m-rev.] for review: fix for functions with class constraints in interface files

Peter Wang wangp at students.cs.mu.OZ.AU
Wed Feb 8 11:07:02 AEDT 2006


Estimated hours taken: 1
Branches: main

compiler/mercury_to_mercury.m:
	Fix a bug where class constraints on functions were being written out
	before the determinism annotation in interface files.

tests/valid/Mercury.options:
tests/valid/Mmakefile:
tests/valid/func_class.m:
	Add a test case.

Index: compiler/mercury_to_mercury.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mercury_to_mercury.m,v
retrieving revision 1.278
diff -u -r1.278 mercury_to_mercury.m
--- compiler/mercury_to_mercury.m	16 Jan 2006 03:08:12 -0000	1.278
+++ compiler/mercury_to_mercury.m	7 Feb 2006 23:31:06 -0000
@@ -2132,9 +2132,9 @@
     ),
     add_string(" = ", !U),
     mercury_format_type(VarSet, AppendVarnums, RetType, !U),
+    mercury_format_det_annotation(MaybeDet, !U),
     mercury_format_class_context(ClassContext, ExistQVars, VarSet,
         AppendVarnums, !U),
-    mercury_format_det_annotation(MaybeDet, !U),
     add_string(Separator, !U).
 
 %-----------------------------------------------------------------------------%
Index: tests/valid/Mercury.options
===================================================================
RCS file: /home/mercury1/repository/tests/valid/Mercury.options,v
retrieving revision 1.25
diff -u -r1.25 Mercury.options
--- tests/valid/Mercury.options	21 Dec 2005 22:11:58 -0000	1.25
+++ tests/valid/Mercury.options	7 Feb 2006 23:53:24 -0000
@@ -40,6 +40,7 @@
 MCFLAGS-double_vn		= -O4
 MCFLAGS-exists_cast_bug		= --trace rep -O0 --optimize-saved-vars-const
 MCFLAGS-explicit_quant		= --halt-at-warn
+MCFLAGS-func_class		= --no-warn-nothing-exported
 MCFLAGS-foreign_underscore_var	= --halt-at-warn
 MCFLAGS-higher_order4		= -O3
 MCFLAGS-higher_order_implied_mode = -O-1
Index: tests/valid/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/tests/valid/Mmakefile,v
retrieving revision 1.163
diff -u -r1.163 Mmakefile
--- tests/valid/Mmakefile	31 Jan 2006 05:20:45 -0000	1.163
+++ tests/valid/Mmakefile	7 Feb 2006 23:53:54 -0000
@@ -26,6 +26,7 @@
 	exists_fundeps_2 \
 	exists_fundeps_3 \
 	flatten_conj_bug \
+	func_class \
 	func_method \
 	fundeps \
 	instance_superclass \
Index: tests/valid/func_class.m
===================================================================
RCS file: tests/valid/func_class.m
diff -N tests/valid/func_class.m
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/valid/func_class.m	7 Feb 2006 23:52:59 -0000
@@ -0,0 +1,20 @@
+:- module func_class.
+
+% Class constraints on functions were being written out before the
+% determinism annotation in interface files.
+:- module func_class1.
+:- interface.
+
+:- typeclass tc(T) where [].
+:- func f(T) = int is det <= tc(T).
+
+:- implementation.
+f(_) = 1.
+
+:- end_module func_class1.
+
+% Read in the faulty interface file.
+:- module func_class2.
+:- implementation.
+:- import_module func_class.func_class1.
+:- end_module func_class2.
--------------------------------------------------------------------------
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