[m-dev.] for review: tests of assertions in the interface

Peter Ross petdr at cs.mu.OZ.AU
Thu Nov 11 18:48:16 AEDT 1999


Hi,

For Fergus to review.

===================================================================


Estimated hours taken: 1

Tests of assertions which are in the interface section of a module.

invalid/Mmakefile:
valid/Mmakefile:
    Call the new tests.

invalid/assert_in_interface.m:
invalid/assert_in_interface.err_exp:
   Test that an assertion in the interface detects that one of the
   symbols in the assertion comes from a module imported in the
   implementation.

invalid/tricky_assert1.m:
invalid/tricky_assert1.err_exp:
    Test that `:- external' declarations are handled correctly.

valid/tricky_assert2.m:
    Test that `:- external' declarations are handled correctly.

Index: invalid/Mmakefile
===================================================================
RCS file: /home/staff/zs/imp/tests/invalid/Mmakefile,v
retrieving revision 1.51
diff -u -r1.51 Mmakefile
--- Mmakefile	1999/10/07 02:32:02	1.51
+++ Mmakefile	1999/11/11 04:47:02
@@ -10,6 +10,7 @@
 	aditi_update_errors.m \
 	aditi_update_mode_errors.m \
 	any_mode.m \
+	assert_in_interface.m \
 	bigtest.m \
 	bind_var_errors.m \
 	builtin_int.m \
@@ -51,6 +52,7 @@
 	some.m \
 	spurious_mode_error.m \
 	test_nested.m \
+	tricky_assert1.m \
 	type_inf_loop.m \
 	type_loop.m \
 	type_mismatch.m \
Index: invalid/assert_in_interface.err_exp
===================================================================
RCS file: assert_in_interface.err_exp
diff -N assert_in_interface.err_exp
--- /dev/null	Thu Nov 11 18:31:27 1999
+++ assert_in_interface.err_exp	Thu Nov 11 16:16:55 1999
@@ -0,0 +1,4 @@
+assert_in_interface.m:005: In interface for module `assert_in_interface':
+assert_in_interface.m:005:   error: exported assertion refers to predicate `list:last/2'
+assert_in_interface.m:005:   which is defined in the implementation of module `assert_in_interface'.
+For more information, try recompiling with `-E'.
Index: invalid/assert_in_interface.m
===================================================================
RCS file: assert_in_interface.m
diff -N assert_in_interface.m
--- /dev/null	Thu Nov 11 18:31:27 1999
+++ assert_in_interface.m	Thu Nov 11 15:43:02 1999
@@ -0,0 +1,8 @@
+	% assertion in the interface refers to a predicate which is
+	% imported in the implementation of the module.
+:- module assert_in_interface.
+:- interface.
+:- assertion all [X, Y] list__last(X, Y).
+
+:- implementation.
+:- import_module list.
Index: invalid/tricky_assert1.err_exp
===================================================================
RCS file: tricky_assert1.err_exp
diff -N tricky_assert1.err_exp
--- /dev/null	Thu Nov 11 18:31:27 1999
+++ tricky_assert1.err_exp	Thu Nov 11 16:16:52 1999
@@ -0,0 +1,4 @@
+tricky_assert1.m:005: In interface for module `tricky_assert1':
+tricky_assert1.m:005:   error: exported assertion refers to predicate `tricky_assert1:local/0'
+tricky_assert1.m:005:   which is defined in the implementation of module `tricky_assert1'.
+For more information, try recompiling with `-E'.
Index: invalid/tricky_assert1.m
===================================================================
RCS file: tricky_assert1.m
diff -N tricky_assert1.m
--- /dev/null	Thu Nov 11 18:31:27 1999
+++ tricky_assert1.m	Thu Nov 11 16:16:28 1999
@@ -0,0 +1,9 @@
+	% this is invalid because the interface refers to stuff defined
+	% only in the implementation
+:- module tricky_assert1.
+:- interface.
+:- assertion tricky_assert1__local.
+
+:- implementation.
+:- pred tricky_assert1__local is semidet.
+:- external(tricky_assert1__local/0).
Index: valid/Mmakefile
===================================================================
RCS file: /home/staff/zs/imp/tests/valid/Mmakefile,v
retrieving revision 1.46
diff -u -r1.46 Mmakefile
--- Mmakefile	1999/11/09 01:07:12	1.46
+++ Mmakefile	1999/11/11 05:33:34
@@ -107,6 +107,7 @@
 	switch_detection_bug.m \
 	switch_detection_bug2.m \
 	switches.m \
+	tricky_assert2.m \
 	tricky_ite.m \
 	two_pragma_c_codes.m \
 	two_way_unif.m \
Index: valid/tricky_assert2.m
===================================================================
RCS file: tricky_assert2.m
diff -N tricky_assert2.m
--- /dev/null	Thu Nov 11 18:31:27 1999
+++ tricky_assert2.m	Thu Nov 11 15:13:17 1999
@@ -0,0 +1,10 @@
+:- module tricky_assert2.
+
+:- interface.
+
+:- pred tricky_assert2__local is semidet.
+:- assertion tricky_assert2__local.
+
+:- implementation.
+:- external(tricky_assert2__local/0).
+

----
 +----------------------------------------------------------------------+
 | Peter Ross      M Sci/Eng Melbourne Uni                              |
 | petdr at cs.mu.oz.au  WWW: www.cs.mu.oz.au/~petdr/ ph: +61 3 9344 9158  |
 +----------------------------------------------------------------------+
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list