[commit: ghc] ghc-7.6: Fix #7231: don't unload stable modules when there is an error later (772e6d2)

Ian Lynagh <[email protected]>
Newsgroups gmane.comp.lang.haskell.cvs.ghc
Message-ID <[email protected]>
Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : ghc-7.6

http://hackage.haskell.org/trac/ghc/changeset/772e6d20bcac691bcfe8528829d6ed100fd701bb

>---------------------------------------------------------------

commit 772e6d20bcac691bcfe8528829d6ed100fd701bb
Author: Simon Marlow <[email protected]>
Date:   Tue Nov 27 08:55:31 2012 +0000

    Fix #7231: don't unload stable modules when there is an error later

>---------------------------------------------------------------

 compiler/main/GhcMake.hs |   17 ++++++++++++-----
 1 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/compiler/main/GhcMake.hs b/compiler/main/GhcMake.hs
index 322c631..f563cd9 100644
--- a/compiler/main/GhcMake.hs
+++ b/compiler/main/GhcMake.hs
@@ -238,11 +238,18 @@ load how_much = do
         stable_mg = 
             [ AcyclicSCC ms
             | AcyclicSCC ms <- full_mg,
-              ms_mod_name ms `elem` stable_obj++stable_bco,
-              ms_mod_name ms `notElem` [ ms_mod_name ms' | 
-                                            AcyclicSCC ms' <- partial_mg ] ]
-
-        mg = stable_mg ++ partial_mg
+              ms_mod_name ms `elem` stable_obj++stable_bco ]
+ 
+        -- the modules from partial_mg that are not also stable
+        -- NB. also keep cycles, we need to emit an error message later
+        unstable_mg = filter not_stable partial_mg
+          where not_stable (CyclicSCC _) = True
+                not_stable (AcyclicSCC ms)
+                   = ms_mod_name ms `notElem` stable_obj++stable_bco
+
+        -- Load all the stable modules first, before attempting to load
+        -- an unstable module (#7231).
+        mg = stable_mg ++ unstable_mg
 
     -- clean up between compilations
     let cleanup hsc_env = intermediateCleanTempFiles dflags
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.