[m-rev.] for review: automatically import sub-modules using include_module

Peter Ross peter.ross at miscrit.be
Thu Nov 15 03:32:18 AEDT 2001


Hi,

I haven't documented this because I am not sure that the existing
documentation doesn't already imply this.

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


Estimated hours taken: 4
Branches: main

Change the semantics of `:- include_module' so that if an interface
contains an include_module then when that interface is imported so is
the one specified by the include_module.  As include_modules are only
allowed to refer to sub-modules this allows one to automatically import
a selective part of a sub-module hierachy by just importing one module.

compiler/modules.m:
    Transitively import all the modules specified by an include_module
    in the interface.

compiler/intermod.m:
    Ignore the include modules.

tests/hard_coded/sub-modules/Mmakefile:
tests/hard_coded/sub-modules/include_module.exp:
tests/hard_coded/sub-modules/include_module.m:
tests/hard_coded/sub-modules/include_parent.m:
tests/hard_coded/sub-modules/include_parent.separate.m:
tests/invalid/Mmakefile:
tests/invalid/include_module.err_exp:
tests/invalid/include_module.m:
tests/invalid/include_parent.m:
    Test the new functionality.

Index: compiler/intermod.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/intermod.m,v
retrieving revision 1.109
diff -u -r1.109 intermod.m
--- compiler/intermod.m	6 Nov 2001 15:20:44 -0000	1.109
+++ compiler/intermod.m	14 Nov 2001 16:21:03 -0000
@@ -2089,7 +2089,8 @@
 		%
 		% Figure out which .int files are needed by the .opt files
 		%
-	{ get_dependencies(OptItems, NewImportDeps0, NewUseDeps0) },
+	{ get_dependencies(OptItems, NewImportDeps0, NewUseDeps0,
+			_NewIncludeDeps0) },
 	globals__io_get_globals(Globals),
 	{ get_implicit_dependencies(OptItems, Globals,
 		NewImplicitImportDeps0, NewImplicitUseDeps0) },
Index: compiler/modules.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/modules.m,v
retrieving revision 1.201
diff -u -r1.201 modules.m
--- compiler/modules.m	14 Nov 2001 15:32:21 -0000	1.201
+++ compiler/modules.m	14 Nov 2001 16:21:09 -0000
@@ -534,19 +534,21 @@
 :- pred generate_file_dependencies(file_name, io__state, io__state).
 :- mode generate_file_dependencies(in, di, uo) is det.
 
-	% get_dependencies(Items, ImportDeps, UseDeps).
+	% get_dependencies(Items, ImportDeps, UseDeps, IncludeDeps).
 	%	Get the list of modules that a list of items (explicitly)
 	%	depends on.  ImportDeps is the list of modules imported using
 	% 	`:- import_module', UseDeps is the list of modules imported
-	%	using `:- use_module'.
+	%	using `:- use_module'.  IncludeDeps is the list of modules
+	%	refered to by an `:- include_module' declaration.
 	%	N.B. Typically you also need to consider the module's
 	%	implicit dependencies (see get_implicit_dependencies/3),
 	%	its parent modules (see get_ancestors/2) and possibly
 	%	also the module's child modules (see get_children/2).
 	%	You may also need to consider indirect dependencies.
 	%
-:- pred get_dependencies(item_list, list(module_name), list(module_name)).
-:- mode get_dependencies(in, out, out) is det.
+:- pred get_dependencies(item_list,
+		list(module_name), list(module_name), list(module_name)).
+:- mode get_dependencies(in, out, out, out) is det.
 
 	% get_implicit_dependencies(Items, Globals, ImportDeps, UseDeps):
 	%	Get the list of builtin modules (e.g. "public_builtin",
@@ -1364,8 +1366,10 @@
 		% Find out which modules this one depends on
 		%
 	{ get_ancestors(ModuleName, AncestorModules) },
-	{ get_dependencies(Items0, IntImportedModules0, IntUsedModules0,
-			ImpImportedModules0, ImpUsedModules0) },
+	{ get_dependencies(Items0,
+			IntImportedModules0, IntUsedModules0,
+			_IntIncModules0, ImpImportedModules0,
+			ImpUsedModules0, _ImpIncModules0) },
 
 	{ list__append(IntImportedModules0, ImpImportedModules0,
 			ImportedModules0) },
@@ -1474,8 +1478,8 @@
 		% Find out which modules this one depends on
 		%
 	{ get_ancestors(ModuleName, ParentDeps) },
-	{ get_dependencies(Items0, IntImportDeps0, IntUseDeps0,
-			ImpImportDeps0, ImpUseDeps0) },
+	{ get_dependencies(Items0, IntImportDeps0, IntUseDeps0, _IntIncDeps0,
+			ImpImportDeps0, ImpUseDeps0, _ImpIncDeps0) },
 
 		%
 		% Construct the initial module import structure,
@@ -4355,14 +4359,14 @@
 		ModuleImports) :-
 	get_ancestors(ModuleName, ParentDeps),
 
-	get_dependencies(Items, ImplImportDeps0, ImplUseDeps0),
+	get_dependencies(Items, ImplImportDeps0, ImplUseDeps0, _ImplIncDeps0),
 	add_implicit_imports(Items, Globals, ImplImportDeps0, ImplUseDeps0,
 		ImplImportDeps, ImplUseDeps),
 	list__append(ImplImportDeps, ImplUseDeps, ImplementationDeps),
 
 	get_interface(Items, InterfaceItems),
 	get_dependencies(InterfaceItems, InterfaceImportDeps0,
-		InterfaceUseDeps0),
+		InterfaceUseDeps0, _IntIncDeps0),
 	add_implicit_imports(InterfaceItems, Globals,
 		InterfaceImportDeps0, InterfaceUseDeps0,
 		InterfaceImportDeps, InterfaceUseDeps),
@@ -4632,7 +4636,11 @@
 		;
 			{ ModAncestors = [Ancestor | ModAncestors0] }
 		),
-		{ get_dependencies(Items, AncDirectImports, AncDirectUses) },
+			% As private interfaces are only used for
+			% handling sub-modules we ignore the Includes.
+		{ get_dependencies(Items, AncDirectImports, AncDirectUses,
+				_Includes) },
+			
 		{ list__append(DirectImports0, AncDirectImports,
 				DirectImports1) },
 		{ list__append(DirectUses0, AncDirectUses, DirectUses1) },
@@ -4640,6 +4648,7 @@
 		{ Module2 = ((Module1 ^ items := ModItems)
 				      ^ parent_deps := ModAncestors)
 				      ^ error := ModError },
+
 		process_module_private_interfaces(ReadModules, Ancestors,
 				DirectImports1, DirectImports, DirectUses1,
 				DirectUses, Module2, Module)
@@ -4695,19 +4704,24 @@
 			check_module_accessibility(ModuleName, Import,
 				ModItems0)
 		),
-		{ get_dependencies(Items, IndirectImports1, IndirectUses1) },
+		{ get_dependencies(Items,
+				IndirectImports1, IndirectUses1, Includes) },
 		{ list__append(IndirectImports0, IndirectImports1,
 			IndirectImports2) },
 		{ list__append(IndirectImports2, IndirectUses1,
 			IndirectImports3) },
+
 		{ list__append(ModItems0, Items, ModItems) },
 		{ Module2 = ((Module1 ^ impl_deps := ModImplementationImports)
 				      ^ items := ModItems)
 				      ^ error := ModError },
 
 		process_module_long_interfaces(ReadModules, NeedQualifier,
-			Imports, Ext, IndirectImports3, IndirectImports,
-			Module2, Module)
+			Includes, Ext, IndirectImports3, IndirectImports4,
+			Module2, Module3),
+		process_module_long_interfaces(ReadModules, NeedQualifier,
+			Imports, Ext, IndirectImports4, IndirectImports,
+			Module3, Module)
 	).
 
 :- pred check_module_accessibility(module_name, module_name, item_list,
@@ -4878,15 +4892,17 @@
 		maybe_report_stats(Statistics),
 
 		{ ModIndirectImports = [Import | ModIndirectImports0] },
-		{ get_dependencies(Items, Imports1, Uses1) },
+		{ get_dependencies(Items, Imports1, Uses1, Includes) },
 		{ list__append(IndirectImports0, Imports1, IndirectImports1) },
 		{ list__append(IndirectImports1, Uses1, IndirectImports2) },
 		{ list__append(ModItems0, Items, ModItems) },
 		{ Module2 = ((Module1 ^ indirect_deps := ModIndirectImports)
 				      ^ items := ModItems)
 				      ^ error := ModError },
+		process_module_short_interfaces(ReadModules, Includes, Ext,
+			IndirectImports2, IndirectImports3, Module2, Module3),
 		process_module_short_interfaces(ReadModules, Imports, Ext,
-			IndirectImports2, IndirectImports, Module2, Module)
+			IndirectImports3, IndirectImports, Module3, Module)
 	).
 
 strip_off_interface_decl(Items0, Items) :-
@@ -4966,14 +4982,16 @@
 
 %-----------------------------------------------------------------------------%
 
-get_dependencies(Items, ImportDeps, UseDeps) :-
-	get_dependencies_implementation(Items, [], [] , [], [],
-			IntImportDeps, IntUseDeps, ImpImportDeps, ImpUseDeps),
+get_dependencies(Items, ImportDeps, UseDeps, IncDeps) :-
+	get_dependencies_implementation(Items, [], [] , [], [], [], [],
+			IntImportDeps, IntUseDeps, IntIncDeps,
+			ImpImportDeps, ImpUseDeps, ImpIncDeps),
 	list__append(IntImportDeps, ImpImportDeps, ImportDeps),
-	list__append(IntUseDeps, ImpUseDeps, UseDeps).
+	list__append(IntUseDeps, ImpUseDeps, UseDeps),
+	list__append(IntIncDeps, ImpIncDeps, IncDeps).
 
 	% get_dependencies(Items, IntImportDeps, IntUseDeps,
-	% 		ImpImportDeps, ImpUseDeps).
+	% 		ImpImportDeps, ImpUseDeps, IntIncDeps).
 	%	Get the list of modules that a list of items (explicitly)
 	%	depends on.
 	%	IntImportDeps is the list of modules imported using `:-
@@ -4982,6 +5000,13 @@
 	%	list of modules imported using `:- use_module' in the
 	%	interface, and ImpUseDeps those modules imported in the
 	%	implementation.
+	%	IntIncDeps is the list of modules imported using
+	%	`:- include_module' in the interface section.
+	%	should be an import_module if the parent module was
+	%	imported using an `:- import_module' and vice versa.
+	%
 	%	N.B. Typically you also need to consider the module's
 	%	implicit dependencies (see get_implicit_dependencies/3),
 	%	its parent modules (see get_ancestors/2) and possibly
@@ -4994,102 +5019,131 @@
 	%
 :- pred get_dependencies(item_list::in,
 		list(module_name)::out, list(module_name)::out,
+		list(module_name)::out, list(module_name)::out,
 		list(module_name)::out, list(module_name)::out) is det.
 
-get_dependencies(Items, IntImportDeps, IntUseDeps, ImpImportDeps, ImpUseDeps) :-
-	get_dependencies_implementation(Items, [], [] , [], [],
-			IntImportDeps, IntUseDeps, ImpImportDeps, ImpUseDeps).
+get_dependencies(Items, IntImportDeps, IntUseDeps, IntIncDeps,
+		ImpImportDeps, ImpUseDeps, ImpIncDeps) :-
+	get_dependencies_implementation(Items, [], [] , [], [], [], [],
+			IntImportDeps, IntUseDeps, IntIncDeps,
+			ImpImportDeps, ImpUseDeps, ImpIncDeps).
 
 :- pred get_dependencies_implementation(item_list::in, list(module_name)::in,
 		list(module_name)::in, list(module_name)::in,
+		list(module_name)::in, list(module_name)::in,
 		list(module_name)::in, list(module_name)::out,
 		list(module_name)::out, list(module_name)::out,
+		list(module_name)::out, list(module_name)::out,
 		list(module_name)::out) is det.
 
-get_dependencies_implementation([], IntImportDeps, IntUseDeps,
-		ImpImportDeps, ImpUseDeps, IntImportDeps, IntUseDeps,
-		ImpImportDeps, ImpUseDeps).
+get_dependencies_implementation([],
+		IntImportDeps, IntUseDeps, IntIncDeps,
+		ImpImportDeps, ImpUseDeps, ImpIncDeps,
+		IntImportDeps, IntUseDeps, IntIncDeps,
+		ImpImportDeps, ImpUseDeps, ImpIncDeps).
 get_dependencies_implementation([Item - _Context | Items],
-		IntImportDeps0, IntUseDeps0,
-		ImpImportDeps0, ImpUseDeps0,
-		IntImportDeps, IntUseDeps,
-		ImpImportDeps, ImpUseDeps) :-
+		IntImportDeps0, IntUseDeps0, IntIncDeps0,
+		ImpImportDeps0, ImpUseDeps0, ImpIncDeps0,
+		IntImportDeps, IntUseDeps, IntIncDeps,
+		ImpImportDeps, ImpUseDeps, ImpIncDeps) :-
 	( 
 		
 		Item = module_defn(_VarSet, interface)
 	->
 		get_dependencies_interface(Items,
-				IntImportDeps0, IntUseDeps0,
-				ImpImportDeps0, ImpUseDeps0,
-				IntImportDeps, IntUseDeps,
-				ImpImportDeps, ImpUseDeps)
+				IntImportDeps0, IntUseDeps0, IntIncDeps0,
+				ImpImportDeps0, ImpUseDeps0, ImpIncDeps0,
+				IntImportDeps, IntUseDeps, IntIncDeps,
+				ImpImportDeps, ImpUseDeps, ImpIncDeps)
 	;
 		(
 		
 			Item = module_defn(_VarSet, import(module(Modules)))
 		->
 			list__append(ImpImportDeps0, Modules, ImpImportDeps1),
+			ImpIncDeps1 = ImpIncDeps0,
 			ImpUseDeps1 = ImpUseDeps0
 		;
 			Item = module_defn(_VarSet, use(module(Modules)))
 		->
 			list__append(ImpUseDeps0, Modules, ImpUseDeps1),
+			ImpIncDeps1 = ImpIncDeps0,
+			ImpImportDeps1 = ImpImportDeps0
+		;
+			Item = module_defn(_VarSet, include_module(Modules))
+		->
+			list__append(ImpIncDeps0, Modules, ImpIncDeps1),
+			ImpUseDeps1 = ImpUseDeps0,
 			ImpImportDeps1 = ImpImportDeps0
 		;
 			ImpImportDeps1 = ImpImportDeps0,
+			ImpIncDeps1 = ImpIncDeps0,
 			ImpUseDeps1 = ImpUseDeps0
 		),
 		get_dependencies_implementation(Items,
-				IntImportDeps0, IntUseDeps0,
-				ImpImportDeps1, ImpUseDeps1,
-				IntImportDeps, IntUseDeps,
-				ImpImportDeps, ImpUseDeps)
+				IntImportDeps0, IntUseDeps0, IntIncDeps0,
+				ImpImportDeps1, ImpUseDeps1, ImpIncDeps1,
+				IntImportDeps, IntUseDeps, IntIncDeps,
+				ImpImportDeps, ImpUseDeps, ImpIncDeps)
 	).
 
 :- pred get_dependencies_interface(item_list::in, list(module_name)::in,
 		list(module_name)::in, list(module_name)::in,
+		list(module_name)::in, list(module_name)::in,
 		list(module_name)::in, list(module_name)::out,
 		list(module_name)::out, list(module_name)::out,
+		list(module_name)::out, list(module_name)::out,
 		list(module_name)::out) is det.
 
-get_dependencies_interface([], IntImportDeps, IntUseDeps,
-		ImpImportDeps, ImpUseDeps, IntImportDeps, IntUseDeps,
-		ImpImportDeps, ImpUseDeps).
+get_dependencies_interface([],
+		IntImportDeps, IntUseDeps, IntIncDeps,
+		ImpImportDeps, ImpUseDeps, ImpIncDeps,
+		IntImportDeps, IntUseDeps, IntIncDeps,
+		ImpImportDeps, ImpUseDeps, ImpIncDeps).
 get_dependencies_interface([Item - _Context | Items],
-		IntImportDeps0, IntUseDeps0,
-		ImpImportDeps0, ImpUseDeps0,
-		IntImportDeps, IntUseDeps,
-		ImpImportDeps, ImpUseDeps) :-
+		IntImportDeps0, IntUseDeps0, IntIncDeps0,
+		ImpImportDeps0, ImpUseDeps0, ImpIncDeps0,
+		IntImportDeps, IntUseDeps, IntIncDeps,
+		ImpImportDeps, ImpUseDeps, ImpIncDeps) :-
 	( 
 		
 		Item = module_defn(_VarSet, implementation)
 	->
 		get_dependencies_implementation(Items,
-				IntImportDeps0, IntUseDeps0,
-				ImpImportDeps0, ImpUseDeps0,
-				IntImportDeps, IntUseDeps,
-				ImpImportDeps, ImpUseDeps)
+				IntImportDeps0, IntUseDeps0, IntIncDeps0,
+				ImpImportDeps0, ImpUseDeps0, ImpIncDeps0,
+				IntImportDeps, IntUseDeps, IntIncDeps,
+				ImpImportDeps, ImpUseDeps, ImpIncDeps)
 	;
 		(
 		
 			Item = module_defn(_VarSet, import(module(Modules)))
 		->
 			list__append(IntImportDeps0, Modules, IntImportDeps1),
+			IntIncDeps1 = IntIncDeps0,
 			IntUseDeps1 = IntUseDeps0
 		;
 			Item = module_defn(_VarSet, use(module(Modules)))
 		->
 			list__append(IntUseDeps0, Modules, IntUseDeps1),
+			IntIncDeps1 = IntIncDeps0,
+			IntImportDeps1 = IntImportDeps0
+		;
+			Item = module_defn(_VarSet, include_module(Modules))
+		->
+			list__append(IntIncDeps0, Modules, IntIncDeps1),
+			IntUseDeps1 = IntUseDeps0,
 			IntImportDeps1 = IntImportDeps0
 		;
 			IntImportDeps1 = IntImportDeps0,
+			IntIncDeps1 = IntIncDeps0,
 			IntUseDeps1 = IntUseDeps0
 		),
 		get_dependencies_interface(Items,
-				IntImportDeps1, IntUseDeps1,
-				ImpImportDeps0, ImpUseDeps0,
-				IntImportDeps, IntUseDeps,
-				ImpImportDeps, ImpUseDeps)
+				IntImportDeps1, IntUseDeps1, IntIncDeps1,
+				ImpImportDeps0, ImpUseDeps0, ImpIncDeps0,
+				IntImportDeps, IntUseDeps, IntIncDeps,
+				ImpImportDeps, ImpUseDeps, ImpIncDeps)
 	).
 
 %-----------------------------------------------------------------------------%
Index: tests/hard_coded/sub-modules/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/tests/hard_coded/sub-modules/Mmakefile,v
retrieving revision 1.3
diff -u -r1.3 Mmakefile
--- tests/hard_coded/sub-modules/Mmakefile	7 Feb 2001 13:50:52 -0000	1.3
+++ tests/hard_coded/sub-modules/Mmakefile	14 Nov 2001 16:21:10 -0000
@@ -18,6 +18,7 @@
 #
 
 PROGS=	\
+	include_module \
 	parent \
 	parent2 \
 	nested \
Index: tests/hard_coded/sub-modules/include_module.exp
===================================================================
RCS file: tests/hard_coded/sub-modules/include_module.exp
diff -N tests/hard_coded/sub-modules/include_module.exp
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/hard_coded/sub-modules/include_module.exp	14 Nov 2001 16:21:10 -0000
@@ -0,0 +1,8 @@
+include_parent: hello
+include_parent__nested: hello
+include_parent__nested: hello
+include_parent__separate: hello
+include_parent__separate: hello
+include_parent__separate: hello2
+include_parent__separate: hello2
+include_parent__separate: hello2
Index: tests/hard_coded/sub-modules/include_module.m
===================================================================
RCS file: tests/hard_coded/sub-modules/include_module.m
diff -N tests/hard_coded/sub-modules/include_module.m
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/hard_coded/sub-modules/include_module.m	14 Nov 2001 16:21:10 -0000
@@ -0,0 +1,24 @@
+% Test that a :- include_module located in the interface section of a
+% module automatically includes that sub-module when the parent module
+% is imported.
+:- module (include_module).
+
+:- interface.
+
+:- import_module io.
+
+:- pred main(io__state::di, io__state::uo) is det.
+
+:- implementation.
+
+:- import_module include_parent.
+
+main -->
+	include_parent__hello,
+	include_parent__nested__hello,
+	nested__hello,
+	include_parent__separate__hello,
+	separate__hello,
+	include_parent__separate__hello2,
+	separate__hello2,
+	hello2.
Index: tests/hard_coded/sub-modules/include_parent.m
===================================================================
RCS file: tests/hard_coded/sub-modules/include_parent.m
diff -N tests/hard_coded/sub-modules/include_parent.m
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/hard_coded/sub-modules/include_parent.m	14 Nov 2001 16:21:10 -0000
@@ -0,0 +1,29 @@
+:- module include_parent.
+
+:- interface.
+
+:- import_module io.
+:- include_module nested, separate.
+
+:- pred hello(io__state::di, io__state::uo) is det.
+
+:- implementation.
+
+hello -->
+	io__write_string("include_parent: hello\n").
+
+%-----------------------------------------------------------------------------%
+
+:- module include_parent__nested.
+:- interface.
+
+:- pred hello(io__state::di, io__state::uo) is det.
+
+:- implementation.
+
+hello -->
+	io__write_string("include_parent__nested: hello\n").
+
+:- end_module include_parent__nested.
+
+%-----------------------------------------------------------------------------%
Index: tests/hard_coded/sub-modules/include_parent.separate.m
===================================================================
RCS file: tests/hard_coded/sub-modules/include_parent.separate.m
diff -N tests/hard_coded/sub-modules/include_parent.separate.m
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/hard_coded/sub-modules/include_parent.separate.m	14 Nov 2001 16:21:10 -0000
@@ -0,0 +1,17 @@
+:- module include_parent__separate.
+
+:- interface.
+
+% The parent module includes io.
+
+:- pred hello(io__state::di, io__state::uo) is det.
+
+:- pred hello2(io__state::di, io__state::uo) is det.
+
+:- implementation.
+
+hello -->
+	io__write_string("include_parent__separate: hello\n").
+
+hello2 -->
+	io__write_string("include_parent__separate: hello2\n").
Index: tests/invalid/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/tests/invalid/Mmakefile,v
retrieving revision 1.100
diff -u -r1.100 Mmakefile
--- tests/invalid/Mmakefile	28 Oct 2001 12:25:58 -0000	1.100
+++ tests/invalid/Mmakefile	14 Nov 2001 16:21:10 -0000
@@ -20,6 +20,7 @@
 	duplicate_instance_2.m \
 	ho_default_func_2.sub.m \
 	imported_mode.m \
+	include_module.m \
 	partial_implied_mode.m \
 	test_nested.m \
 	transitive_import.m \
Index: tests/invalid/include_module.err_exp
===================================================================
RCS file: tests/invalid/include_module.err_exp
diff -N tests/invalid/include_module.err_exp
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/invalid/include_module.err_exp	14 Nov 2001 16:21:10 -0000
@@ -0,0 +1,3 @@
+include_module.m:017: In clause for predicate `include_module:main/2':
+include_module.m:017:   error: undefined predicate `hello_nested/2'.
+For more information, try recompiling with `-E'.
Index: tests/invalid/include_module.m
===================================================================
RCS file: tests/invalid/include_module.m
diff -N tests/invalid/include_module.m
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/invalid/include_module.m	14 Nov 2001 16:21:10 -0000
@@ -0,0 +1,17 @@
+% Ensure that the sub-module, nested, of include_parent is also treated
+% like it was imported with a use_module and hence requires fully
+% qualified names.
+:- module (include_module).
+
+:- interface.
+
+:- import_module io.
+
+:- pred main(io__state::di, io__state::uo) is det.
+
+:- implementation.
+
+:- use_module include_parent.
+
+main -->
+	hello_nested.
Index: tests/invalid/include_parent.m
===================================================================
RCS file: tests/invalid/include_parent.m
diff -N tests/invalid/include_parent.m
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/invalid/include_parent.m	14 Nov 2001 16:21:10 -0000
@@ -0,0 +1,29 @@
+:- module include_parent.
+
+:- interface.
+
+:- import_module io.
+:- include_module nested.
+
+:- pred hello(io__state::di, io__state::uo) is det.
+
+:- implementation.
+
+hello -->
+	io__write_string("include_parent: hello\n").
+
+%-----------------------------------------------------------------------------%
+
+:- module include_parent__nested.
+:- interface.
+
+:- pred hello_nested(io__state::di, io__state::uo) is det.
+
+:- implementation.
+
+hello_nested -->
+	io__write_string("include_parent__nested: hello_nested\n").
+
+:- end_module include_parent__nested.
+
+%-----------------------------------------------------------------------------%

--------------------------------------------------------------------------
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