summaryrefslogtreecommitdiff
path: root/compiler/main/GhcMake.hs
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2012-11-27 08:55:31 +0000
committerSimon Marlow <marlowsd@gmail.com>2012-11-27 10:19:23 +0000
commit086d7c54f5bddbc9e5d94a9ae9c4b5aeeab53a35 (patch)
tree7a26dd415769c77a63097e36603d0d5ef4a052a6 /compiler/main/GhcMake.hs
parent3a8261827fd9e66251a4a8bf91a22ae075bfdcb9 (diff)
downloadhaskell-086d7c54f5bddbc9e5d94a9ae9c4b5aeeab53a35.tar.gz
Fix #7231: don't unload stable modules when there is an error later
Diffstat (limited to 'compiler/main/GhcMake.hs')
-rw-r--r--compiler/main/GhcMake.hs17
1 files changed, 12 insertions, 5 deletions
diff --git a/compiler/main/GhcMake.hs b/compiler/main/GhcMake.hs
index 62ac63fc1d..cc51e0591c 100644
--- a/compiler/main/GhcMake.hs
+++ b/compiler/main/GhcMake.hs
@@ -239,11 +239,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