changeset 1092:6f4b05fc4361

Catch attempts to mention multiple versions of the same rooted module
author Adam Chlipala <adamc@hcoop.net>
date Fri, 25 Dec 2009 10:48:02 -0500
parents 6e5463a53c3c
children 8d3aa6c7cee0
files src/compiler.sml
diffstat 1 files changed, 11 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/compiler.sml	Fri Dec 25 09:24:21 2009 -0500
+++ b/src/compiler.sml	Fri Dec 25 10:48:02 2009 -0500
@@ -431,7 +431,9 @@
                             rewrites = #rewrites old @ #rewrites new,
                             filterUrl = #filterUrl old @ #filterUrl new,
                             filterMime = #filterMime old @ #filterMime new,
-                            sources = #sources new @ #sources old,
+                            sources = #sources new
+                                      @ List.filter (fn s => List.all (fn s' => s' <> s) (#sources new))
+                                                    (#sources old),
                             protocol = mergeO #2 (#protocol old, #protocol new),
                             dbms = mergeO #2 (#dbms old, #dbms new)
                         }
@@ -681,6 +683,7 @@
                       end
 
                   val defed = ref SS.empty
+                  val fulls = ref SS.empty
 
                   fun parseOne fname =
                       let
@@ -716,6 +719,7 @@
                                                                             andalso Char.isAlpha (String.sub (s, 0)))
                                                                    pieces
                                           val pieces = map capitalize pieces
+                                          val full = String.concatWith "." pieces
 
                                           fun makeD prefix pieces =
                                               case pieces of
@@ -738,6 +742,12 @@
                                                        loc)
                                                   end
                                       in
+                                          if SS.member (!fulls, full) then
+                                              ErrorMsg.error ("Rooted module " ^ full ^ " has multiple versions.")
+                                          else
+                                              ();
+                                          fulls := SS.add (!fulls, full);
+
                                           makeD "" pieces
                                       end
                       in