summaryrefslogtreecommitdiff
path: root/compiler/main/GhcMake.hs
diff options
context:
space:
mode:
authorEdward Z. Yang <ezyang@cs.stanford.edu>2015-07-20 20:16:40 -0700
committerEdward Z. Yang <ezyang@cs.stanford.edu>2015-07-20 20:54:05 -0700
commit214596de224afa576a9c295bcf53c6941d6892e0 (patch)
tree2b3f6d3436e719dcd7d40a72d707e52e02496ea6 /compiler/main/GhcMake.hs
parent0c6c015d42c2bd0ee008f790c7c0cb4c5b78ca6b (diff)
downloadhaskell-214596de224afa576a9c295bcf53c6941d6892e0.tar.gz
Revert "Revert "Support for multiple signature files in scope.""
This reverts commit bac927b9770ff769128b66d13a3e72bf5a9bc514. As it turns out, we need these commits for separate compilation and accurate dependency tracking. So back in they go!
Diffstat (limited to 'compiler/main/GhcMake.hs')
-rw-r--r--compiler/main/GhcMake.hs19
1 files changed, 17 insertions, 2 deletions
diff --git a/compiler/main/GhcMake.hs b/compiler/main/GhcMake.hs
index 2d1d9ebf52..89cab9ef3a 100644
--- a/compiler/main/GhcMake.hs
+++ b/compiler/main/GhcMake.hs
@@ -1815,7 +1815,10 @@ findSummaryBySourceFile summaries file
[] -> Nothing
(x:_) -> Just x
--- Summarise a module, and pick up source and timestamp.
+-- | Summarise a module, and pick up source and timestamp.
+-- Returns @Nothing@ if the module is excluded via @excl_mods@ or is an
+-- external package module (which we don't compile), otherwise returns the
+-- new module summary (or an error saying why we couldn't summarise it).
summariseModule
:: HscEnv
-> NodeMap ModSummary -- Map of old summaries
@@ -1877,7 +1880,10 @@ summariseModule hsc_env old_summary_map is_boot (L loc wanted_mod)
uncacheModule hsc_env wanted_mod
found <- findImportedModule hsc_env wanted_mod Nothing
case found of
- Found location mod
+ -- TODO: When we add -alias support, we can validly find
+ -- multiple signatures in the home package; need to make this
+ -- logic more flexible in that case.
+ FoundModule (FoundHs { fr_loc = location, fr_mod = mod })
| isJust (ml_hs_file location) ->
-- Home package
just_found location mod
@@ -1886,6 +1892,15 @@ summariseModule hsc_env old_summary_map is_boot (L loc wanted_mod)
ASSERT(modulePackageKey mod /= thisPackage dflags)
return Nothing
+ FoundSigs hs _backing
+ | Just (FoundHs { fr_loc = location, fr_mod = mod })
+ <- find (isJust . ml_hs_file . fr_loc) hs ->
+ just_found location mod
+ | otherwise ->
+ ASSERT(all (\h -> modulePackageKey (fr_mod h)
+ /= thisPackage dflags) hs)
+ return Nothing
+
err -> return $ Just $ Left $ noModError dflags loc wanted_mod err
-- Not found