X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Fiface%2FLoadIface.lhs;h=1ebbd39b75b6c389df3b0941a81507eee71455e2;hb=8a2809c29de9f23eba7ca682b48390033a9d40f6;hp=1c8b410123d607458594776456bf874016b9a21c;hpb=098f818b622e5095fbd3f6318a463fcb2ce14fc6;p=ghc-hetmet.git diff --git a/compiler/iface/LoadIface.lhs b/compiler/iface/LoadIface.lhs index 1c8b410..1ebbd39 100644 --- a/compiler/iface/LoadIface.lhs +++ b/compiler/iface/LoadIface.lhs @@ -38,7 +38,6 @@ import InstEnv import FamInstEnv import Name import NameEnv -import NameSet import MkId import Module import OccName @@ -52,7 +51,6 @@ import Outputable import BinIface import Panic -import Control.Monad (when) import Data.List import Data.Maybe import Data.IORef @@ -120,6 +118,7 @@ loadInterfaceForName doc name -- | An 'IfM' function to load the home interface for a wired-in thing, -- so that we're sure that we see its instance declarations and rules +-- See Note [Loading instances] loadWiredInHomeIface :: Name -> IfM lcl () loadWiredInHomeIface name = ASSERT( isWiredInName name ) @@ -136,6 +135,27 @@ loadSysInterface doc mod_name Succeeded iface -> return iface } \end{code} +Note [Loading instances] +~~~~~~~~~~~~~~~~~~~~~~~~ +We need to make sure that we have at least *read* the interface files +for any module with an instance decl or RULE that we might want. + +* If the instance decl is an orphan, we have a whole separate mechanism + (loadOprhanModules) + +* If the instance decl not an orphan, then the act of looking at the + TyCon or Class will force in the defining module for the + TyCon/Class, and hence the instance decl + +* BUT, if the TyCon is a wired-in TyCon, we don't really need its interface; + but we must make sure we read its interface in case it has instances or + rules. That is what LoadIface.loadWiredInHomeInterface does. It's called + from TcIface.{tcImportDecl, checkWiredInTyCon, ifCHeckWiredInThing} + +All of this is done by the type checker. The renamer plays no role. +(It used to, but no longer.) + + %********************************************************* %* * @@ -369,8 +389,7 @@ loadDecl ignore_prags mod (_version, decl) -- * location -- imported name, to fix the module correctly in the cache mk_new_bndr mod occ - = newGlobalBinder mod occ - (importedSrcLoc (showSDoc (ppr (moduleName mod)))) + = newGlobalBinder mod occ (importedSrcSpan (moduleNameFS (moduleName mod))) -- ToDo: qualify with the package name if necessary doc = ptext SLIT("Declaration for") <+> ppr (ifName decl) @@ -658,8 +677,15 @@ pprFixities fixes = ptext SLIT("fixities") <+> pprWithCommas pprFix fixes pprFix (occ,fix) = ppr fix <+> ppr occ pprVectInfo :: IfaceVectInfo -> SDoc -pprVectInfo (IfaceVectInfo names) = - ptext SLIT("Closured converted:") <+> hsep (map ppr names) +pprVectInfo (IfaceVectInfo { ifaceVectInfoCCVar = vars + , ifaceVectInfoCCTyCon = tycons + , ifaceVectInfoCCTyConReuse = tyconsReuse + }) = + vcat + [ ptext SLIT("CC'ed variables:") <+> hsep (map ppr vars) + , ptext SLIT("CC'ed tycons:") <+> hsep (map ppr tycons) + , ptext SLIT("CC reused tycons:") <+> hsep (map ppr tyconsReuse) + ] pprDeprecs NoDeprecs = empty pprDeprecs (DeprecAll txt) = ptext SLIT("Deprecate all") <+> doubleQuotes (ftext txt)