summaryrefslogtreecommitdiff
path: root/compiler/iface/LoadIface.hs
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2015-02-11 10:55:10 +0000
committerSimon Peyton Jones <simonpj@microsoft.com>2015-02-11 11:18:24 +0000
commit6ff3db92140e3ac8cbda50d1a4aab976350ac8c4 (patch)
tree2560bc260b80fd79f6eeff258119a0e27dbebd7f /compiler/iface/LoadIface.hs
parent3568bf3fe76b95208f650f356a0668113838d842 (diff)
downloadhaskell-6ff3db92140e3ac8cbda50d1a4aab976350ac8c4.tar.gz
nameIsLocalOrFrom should include interactive modules
The provoking cause was Trac #10019, but it revealed that nameIsLocalOrFrom should really include all interactive modules (ones from the 'interactive' package). Previously we had some ad-hoc 'isInteractiveModule' tests with some (but not all) the calls to nameIsLocalOrFrom. See the new comments with Name.nameIsLocalOrFrom.
Diffstat (limited to 'compiler/iface/LoadIface.hs')
-rw-r--r--compiler/iface/LoadIface.hs16
1 files changed, 7 insertions, 9 deletions
diff --git a/compiler/iface/LoadIface.hs b/compiler/iface/LoadIface.hs
index 51f6bae20e..169e929ae4 100644
--- a/compiler/iface/LoadIface.hs
+++ b/compiler/iface/LoadIface.hs
@@ -320,17 +320,15 @@ loadModuleInterfaces doc mods
load mod = loadSysInterface (doc <+> parens (ppr mod)) mod
-- | Loads the interface for a given Name.
+-- Should only be called for an imported name;
+-- otherwise loadSysInterface may not find the interface
loadInterfaceForName :: SDoc -> Name -> TcRn ModIface
loadInterfaceForName doc name
- = do {
- when debugIsOn $ do
- -- Should not be called with a name from the module being compiled
- { this_mod <- getModule
- ; MASSERT2( not (nameIsLocalOrFrom this_mod name), ppr name <+> parens doc )
- }
- ; ASSERT2( isExternalName name, ppr name )
- initIfaceTcRn $ loadSysInterface doc (nameModule name)
- }
+ = do { when debugIsOn $ -- Check pre-condition
+ do { this_mod <- getModule
+ ; MASSERT2( not (nameIsLocalOrFrom this_mod name), ppr name <+> parens doc ) }
+ ; ASSERT2( isExternalName name, ppr name )
+ initIfaceTcRn $ loadSysInterface doc (nameModule name) }
-- | Loads the interface for a given Module.
loadInterfaceForModule :: SDoc -> Module -> TcRn ModIface