[m-rev.] Added unsafe_promise_unique/1 func

Ralph Becket rafe at cs.mu.OZ.AU
Wed Dec 19 13:56:08 AEDT 2001


Fergus Henderson, Wednesday, 19 December 2001:
> On 19-Dec-2001, Ralph Becket <rafe at cs.mu.OZ.AU> wrote:
> > 
> > Well, unsafe_promise_unique/2 is called from
> > hard_coded/unused_float_box_test.m; is there any need for a separate
> > test case involving unsafe_promise_unique/1?
> 
> IMHO yes, to check that the code for builtins handles it correctly.

Okay, I've checked in NEWS and builtin.m with the requested changes
and added a new test file:


Index: Mmakefile
===================================================================
RCS file: /home/mercury1/repository/tests/general/Mmakefile,v
retrieving revision 1.34
diff -u -r1.34 Mmakefile
--- Mmakefile	2 Sep 2001 10:33:06 -0000	1.34
+++ Mmakefile	13 Dec 2001 05:29:29 -0000
@@ -40,6 +40,7 @@
 		io_regression \
 		liveness \
 		liveness2 \
+		map_corresponding \
 		mode_inf \
 		mode_inf_bug \
 		mode_inference_reorder \

Index: unsafe_uniqueness.m
===================================================================
RCS file: unsafe_uniqueness.m
diff -N unsafe_uniqueness.m
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ unsafe_uniqueness.m	19 Dec 2001 02:50:27 -0000
@@ -0,0 +1,41 @@
+%------------------------------------------------------------------------------%
+% unsafe_uniqueness.m
+% Ralph Becket <rafe at cs.mu.oz.au>
+% Wed Dec 19 13:42:42 EST 2001
+% vim: ft=mercury ff=unix ts=4 sw=4 et tw=0 wm=0
+%
+% Test of built-in unsafe_promise_unique/1.  This shouldn't compile
+% if there's a problem with unsafe_promise_unique/1.
+%
+%------------------------------------------------------------------------------%
+
+:- module unsafe_uniqueness.
+
+:- interface.
+
+:- import_module io.
+
+
+
+:- type wrapper(T) ---> wrapper(T).
+
+:- func unwrap(wrapper(T)) = T.
+:- mode unwrap(di) = uo is det.
+
+
+
+:- pred main(io::di, io::uo) is det.
+
+%------------------------------------------------------------------------------%
+%------------------------------------------------------------------------------%
+
+:- implementation.
+
+unwrap(wrapper(X)) = unsafe_promise_unique(X).
+
+%------------------------------------------------------------------------------%
+
+main --> io__print("I must have compiled!\n").
+
+%------------------------------------------------------------------------------%
+%------------------------------------------------------------------------------%

Index: unsafe_uniqueness.exp
===================================================================
RCS file: unsafe_uniqueness.exp
diff -N unsafe_uniqueness.exp
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ unsafe_uniqueness.exp	19 Dec 2001 02:50:45 -0000
@@ -0,0 +1 @@
+I must have compiled!
--------------------------------------------------------------------------
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