diff options
author | Thomas Schilling <nominolo@googlemail.com> | 2008-10-08 14:40:32 +0000 |
---|---|---|
committer | Thomas Schilling <nominolo@googlemail.com> | 2008-10-08 14:40:32 +0000 |
commit | 421b380e75a04f4e1e8e110b46a4bf872e006f79 (patch) | |
tree | 7af665c1528bb94c4968c54c6d8e5bde103e91bd | |
parent | 311df5db57b78a34d195f554cca805a057741709 (diff) | |
download | haskell-421b380e75a04f4e1e8e110b46a4bf872e006f79.tar.gz |
Make 'getModSummary' deterministic.
-rw-r--r-- | compiler/main/GHC.hs | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/compiler/main/GHC.hs b/compiler/main/GHC.hs index 3d8ade9930..38208a0c69 100644 --- a/compiler/main/GHC.hs +++ b/compiler/main/GHC.hs @@ -998,17 +998,18 @@ type TypecheckedSource = LHsBinds Id -- | Return the 'ModSummary' of a module with the given name. -- -- The module must be part of the module graph (see 'hsc_mod_graph' and --- 'ModuleGraph'). If this is not the case, this function will throw an +-- 'ModuleGraph'). If this is not the case, this function will throw a -- 'GhcApiError'. -- --- Note that the module graph may contain several 'ModSummary's matching the --- same name (for example both a @.hs@ and a @.hs-boot@). +-- This function ignores boot modules and requires that there is only one +-- non-boot module with the given name. getModSummary :: GhcMonad m => ModuleName -> m ModSummary getModSummary mod = do mg <- liftM hsc_mod_graph getSession - case [ ms | ms <- mg, ms_mod_name ms == mod ] of + case [ ms | ms <- mg, ms_mod_name ms == mod, not (isBootSummary ms) ] of [] -> throw $ mkApiErr (text "Module not part of module graph") - (ms:_) -> return ms + [ms] -> return ms + multiple -> throw $ mkApiErr (text "getModSummary is ambiguous: " <+> ppr multiple) -- | Parse a module. -- |