[m-dev.] diff: fix recently-introduced bug with reading interfaces

Fergus Henderson fjh at cs.mu.OZ.AU
Tue Nov 23 13:35:15 AEDT 1999


Estimated hours taken: 0.75

Fix a bug in petdr's recent change to modules.m which broke
a recent development version of muz.

compiler/modules.m:
	Fix a bug: we need to read in all the long interfaces before
	reading in any of the short interfaces, otherwise we might try
	reading in both the short and the long interface for a module,
	which would lead to duplicate type definitions.

Workspace: /home/mercury0/fjh/mercury
Index: compiler/modules.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/modules.m,v
retrieving revision 1.111
diff -u -d -r1.111 modules.m
--- modules.m	1999/11/11 23:12:04	1.111
+++ modules.m	1999/11/23 02:24:08
@@ -1118,29 +1118,31 @@
 		% Process the modules imported using `import_module'.
 	{ IntIndirectImports0 = [] },
 	process_module_long_interfaces(IntImportedModules, ".int",
-		IntIndirectImports0, IntIndirectImports1, Module3, Module3a),
+		IntIndirectImports0, IntIndirectImports1, Module3, Module4),
 
-	{ append_pseudo_decl(Module3a, imported(implementation), Module3b) },
+	{ append_pseudo_decl(Module4, imported(implementation), Module5) },
 
 	{ ImpIndirectImports0 = [] },
 	process_module_long_interfaces(ImpImportedModules, ".int",
-		ImpIndirectImports0, ImpIndirectImports1, Module3b, Module4),
+		ImpIndirectImports0, ImpIndirectImports1, Module5, Module6),
 
-		% Process the modules imported using `use_module' 
-		% and the short interfaces for indirectly imported
-		% modules. The short interfaces are treated as if
-		% they are imported using `use_module'.
-	{ append_pseudo_decl(Module4, used(interface), Module5) },
+		% Process the modules imported using `use_module' .
+	{ append_pseudo_decl(Module6, used(interface), Module7) },
 	process_module_long_interfaces(IntUsedModules, ".int",
-		IntIndirectImports1, IntIndirectImports, Module5, Module6),
-	process_module_short_interfaces_transitively(IntIndirectImports,
-		".int2", Module6, Module7),
-
-	{ append_pseudo_decl(Module7, used(implementation), Module8) },
+		IntIndirectImports1, IntIndirectImports, Module7, Module8),
+	{ append_pseudo_decl(Module8, used(implementation), Module9) },
 	process_module_long_interfaces(ImpUsedModules, ".int",
-		ImpIndirectImports1, ImpIndirectImports, Module8, Module9),
+		ImpIndirectImports1, ImpIndirectImports, Module9, Module10),
+
+		% Process the short interfaces for indireclty imported modules.
+		% The short interfaces are treated as if
+		% they are imported using `use_module'.
+	{ append_pseudo_decl(Module10, used(interface), Module11) },
+	process_module_short_interfaces_transitively(IntIndirectImports,
+		".int2", Module11, Module12),
+	{ append_pseudo_decl(Module12, used(implementation), Module13) },
 	process_module_short_interfaces_transitively(ImpIndirectImports,
-		".int2", Module9, Module),
+		".int2", Module13, Module),
 
 	{ module_imports_get_error(Module, Error) }.
 
@@ -1180,34 +1182,38 @@
 
 		% then the .int3s for `:- import'-ed modules
 	process_module_long_interfaces(IntImportDeps, ".int3",
-			[], IntIndirectImportDeps0, Module2, Module2a),
+			[], IntIndirectImportDeps0, Module2, Module3),
 
-	{ append_pseudo_decl(Module2a, imported(implementation), Module2b) },
+	{ append_pseudo_decl(Module3, imported(implementation), Module4) },
 
 	process_module_private_interfaces(ParentDeps,
 			ImpImportDeps0, ImpImportDeps, ImpUseDeps0, ImpUseDeps,
-			Module2b, Module2c),
+			Module4, Module5),
 
 	process_module_long_interfaces(ImpImportDeps, ".int3",
-			[], ImpIndirectImportDeps0, Module2c, Module3),
+			[], ImpIndirectImportDeps0, Module5, Module6),
 
-		% then (after a `:- used' decl)
+		% then (after appropriate `:- used' decls)
 		% the .int3s for `:- use'-ed modules
-		% and indirectly imported modules
-	{ append_pseudo_decl(Module3, used(interface), Module4) },
+	{ append_pseudo_decl(Module6, used(interface), Module7) },
 	process_module_long_interfaces(IntUseDeps, ".int3",
 			IntIndirectImportDeps0, IntIndirectImportDeps,
-			Module4, Module5),
-	process_module_short_interfaces_transitively(
-			IntIndirectImportDeps, ".int3", Module5, Module6),
-
-	{ append_pseudo_decl(Module6, used(implementation), Module7) },
+			Module7, Module8),
+	{ append_pseudo_decl(Module8, used(implementation), Module9) },
 	process_module_long_interfaces(ImpUseDeps, ".int3",
 			ImpIndirectImportDeps0, ImpIndirectImportDeps,
-			Module7, Module8),
+			Module9, Module10),
+
+		% then (after appropriate `:- used' decl)
+		% the .int3s for indirectly imported modules
+	{ append_pseudo_decl(Module10, used(interface), Module11) },
 	process_module_short_interfaces_transitively(
-			ImpIndirectImportDeps, ".int3", Module8, Module),
+			IntIndirectImportDeps, ".int3", Module11, Module12),
 
+	{ append_pseudo_decl(Module12, used(implementation), Module13) },
+	process_module_short_interfaces_transitively(
+			ImpIndirectImportDeps, ".int3", Module13, Module),
+
 	{ module_imports_get_error(Module, Error) }.
 
 %-----------------------------------------------------------------------------%

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3        |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
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