[m-rev.] for review: undefined types of du fields in :- implementation of .int files
Peter Wang
novalazy at gmail.com
Wed Jan 13 15:38:48 AEDT 2010
On 2010-01-13, Julien Fischer <juliensf at csse.unimelb.edu.au> wrote:
>
> On Mon, 11 Jan 2010, Peter Wang wrote:
>
> >Branches: main
> >
> >Fix a problem where a d.u. type which is written out to the implementation
> >section of an interface file may have field types which are not defined
> >anywhere. This is the case when a d.u. type has a foreign type definition.
> >
> >compiler/modules.m:
> > Make `get_requirements_of_impl_exported_types' accumulate the types of
> > the fields of the d.u. types it encounters.
>
> That looks fine. Test case?
Wasn't so hard to make one after all.
diff --git a/tests/valid/Mmakefile b/tests/valid/Mmakefile
index f1d2608..4b48afa 100644
--- a/tests/valid/Mmakefile
+++ b/tests/valid/Mmakefile
@@ -98,6 +98,7 @@ OTHER_PROGS= \
fail_ite \
file_stream_instances \
followcode_det_problem \
+ foreign_du_field \
foreign_underscore_var \
func_default_modes \
func_in_head \
diff --git a/tests/valid/foreign_du_field.m b/tests/valid/foreign_du_field.m
new file mode 100644
index 0000000..0072322
--- /dev/null
+++ b/tests/valid/foreign_du_field.m
@@ -0,0 +1,14 @@
+% Regression test. When a type is written out to the implementation section of
+% an interface file (because it has an alternative foreign type definition),
+% the types of its fields must not be undefined.
+
+:- module foreign_du_field.
+:- interface.
+
+:- import_module foreign_du_field2.
+
+:- type wrap
+ ---> wrap(abstype).
+
+%-----------------------------------------------------------------------------%
+% vim: ft=mercury ts=8 sts=4 sw=4 et
diff --git a/tests/valid/foreign_du_field2.m b/tests/valid/foreign_du_field2.m
new file mode 100644
index 0000000..3dfb22f
--- /dev/null
+++ b/tests/valid/foreign_du_field2.m
@@ -0,0 +1,17 @@
+:- module foreign_du_field2.
+:- interface.
+
+:- type abstype.
+
+:- implementation.
+
+:- type abstype
+ ---> abstype(hiddentype).
+
+:- type hiddentype
+ ---> hiddentype(int, int).
+
+:- pragma foreign_type("Java", abstype, "Object").
+
+%-----------------------------------------------------------------------------%
+% vim: ft=mercury ts=8 sts=4 sw=4 et
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to: mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions: mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------
More information about the reviews
mailing list