[m-rev.] Trivial diff: bugfix for missing solver init preds

Ralph Becket rafe at cs.mu.OZ.AU
Wed Mar 9 15:51:38 AEDT 2005


Estimated hours taken: 3
Branches: main, release

compiler/special_pred.m:
	Ensure that initialisation special preds are type checked (without
	this, the compiler will abort during purity checking if the user
	defines a solver type, but not its initialisation predicate.)

tests/invalid/Mmakefile:
tests/invalid/missing_init_pred.m:
tests/invalid/missing_init_pred.err_exp:
	Added a test case.

Index: compiler/special_pred.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/special_pred.m,v
retrieving revision 1.48
diff -u -r1.48 special_pred.m
--- compiler/special_pred.m	10 Feb 2005 04:10:28 -0000	1.48
+++ compiler/special_pred.m	9 Mar 2005 04:36:04 -0000
@@ -243,6 +243,8 @@
 		list__member(Ctor, Ctors),
 		Ctor = ctor(ExistQTVars, _, _, _),
 		ExistQTVars \= []
+	;
+		type_body_is_solver_type(ModuleInfo, Body)
 	).
 
 can_generate_special_pred_clauses_for_type(ModuleInfo, TypeCtor, Body) :-
Index: tests/invalid/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/tests/invalid/Mmakefile,v
retrieving revision 1.157
diff -u -r1.157 Mmakefile
--- tests/invalid/Mmakefile	19 Jan 2005 05:53:06 -0000	1.157
+++ tests/invalid/Mmakefile	9 Mar 2005 04:47:51 -0000
@@ -96,6 +96,7 @@
 	merge_ground_any \
 	method_impl \
 	missing_det_decls \
+	missing_init_pred \
 	missing_interface_import \
 	mode_inf \
 	modes_erroneous \
Index: tests/invalid/missing_init_pred.err_exp
===================================================================
RCS file: tests/invalid/missing_init_pred.err_exp
diff -N tests/invalid/missing_init_pred.err_exp
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/invalid/missing_init_pred.err_exp	9 Mar 2005 04:49:46 -0000
@@ -0,0 +1,3 @@
+missing_init_pred.m:020: In clause for initialisation predicate for type missing_init_pred.t:
+missing_init_pred.m:020:   error: undefined predicate `missing_init_pred.init/1'.
+For more information, try recompiling with `-E'.
Index: tests/invalid/missing_init_pred.m
===================================================================
RCS file: tests/invalid/missing_init_pred.m
diff -N tests/invalid/missing_init_pred.m
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/invalid/missing_init_pred.m	9 Mar 2005 04:47:10 -0000
@@ -0,0 +1,27 @@
+%-----------------------------------------------------------------------------%
+% missing_init_pred.m
+% Ralph Becket <rafe at cs.mu.oz.au>
+% Wed Mar  9 12:24:52 EST 2005
+% vim: ft=mercury ts=4 sw=4 et wm=0 tw=0
+%
+%-----------------------------------------------------------------------------%
+
+:- module missing_init_pred.
+
+:- interface.
+
+:- solver type t.
+
+%-----------------------------------------------------------------------------%
+%-----------------------------------------------------------------------------%
+
+:- implementation.
+
+:- solver type t
+    where   representation is int,
+            initialisation is init,
+            ground is ground,
+            any is ground.
+
+%-----------------------------------------------------------------------------%
+%-----------------------------------------------------------------------------%
--------------------------------------------------------------------------
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