X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fcompiler%2Fiface%2FTcIface.lhs;h=0167fdbb6cb3adf08c6caeebbbcb3af33ac34941;hb=ff9ab413f6ea513f1aea29c987805d022b72109a;hp=8935f6f5a8e5eed537a85440fed1a43cb9430e11;hpb=8ec76b056b1da2ab9fae3dbf572f01aa2f37e296;p=ghc-hetmet.git diff --git a/ghc/compiler/iface/TcIface.lhs b/ghc/compiler/iface/TcIface.lhs index 8935f6f..0167fdb 100644 --- a/ghc/compiler/iface/TcIface.lhs +++ b/ghc/compiler/iface/TcIface.lhs @@ -13,7 +13,8 @@ module TcIface ( #include "HsVersions.h" import IfaceSyn -import LoadIface ( loadHomeInterface, loadInterface, predInstGates, discardDeclPrags ) +import LoadIface ( loadHomeInterface, loadInterface, predInstGates, + discardDeclPrags, loadDecls ) import IfaceEnv ( lookupIfaceTop, lookupIfaceExt, newGlobalBinder, lookupOrig, extendIfaceIdEnv, extendIfaceTyVarEnv, newIPName, tcIfaceTyVar, tcIfaceLclId, @@ -22,7 +23,7 @@ import BuildTyCl ( buildSynTyCon, buildAlgTyCon, buildDataCon, buildClass, mkAbstractTyConRhs, mkDataTyConRhs, mkNewTyConRhs ) import TcRnMonad import Type ( liftedTypeKind, splitTyConApp, - mkTyVarTys, mkGenTyConApp, mkTyVarTys, ThetaType, pprClassPred ) + mkTyVarTys, mkGenTyConApp, ThetaType, pprClassPred ) import TypeRep ( Type(..), PredType(..) ) import TyCon ( TyCon, tyConName ) import HscTypes ( ExternalPackageState(..), EpsStats(..), PackageInstEnv, @@ -177,30 +178,18 @@ typecheckIface hsc_env iface -- It's not actually *wrong* to do so, but in fact GHCi is unable -- to handle unboxed tuples, so it must not see unfoldings. ignore_prags <- doptM Opt_IgnoreInterfacePragmas - ; let { decls | ignore_prags = map (discardDeclPrags . snd) (mi_decls iface) - | otherwise = map snd (mi_decls iface) - ; rules | ignore_prags = [] - | otherwise = mi_rules iface - ; dfuns = mi_insts iface - ; mod = mi_module iface - } - -- Typecheck the decls - ; names <- mappM (lookupOrig mod . ifName) decls - ; ty_things <- fixM (\ rec_ty_things -> do - { writeMutVar tc_env_var (mkNameEnv (names `zipLazy` rec_ty_things)) - -- This only makes available the "main" things, - -- but that's enough for the strictly-checked part - ; mapM tcIfaceDecl decls }) - - -- Now augment the type envt with all the implicit things - -- These will be needed when type-checking the unfoldings for - -- the IfaceIds, but this is done lazily, so writing the thing - -- now is sufficient - ; let { add_implicits main_thing = main_thing : implicitTyThings main_thing - ; type_env = mkTypeEnv (concatMap add_implicits ty_things) } + + -- Load & typecheck the decls + ; decl_things <- loadDecls ignore_prags (mi_decls iface) + + ; let type_env = mkNameEnv decl_things ; writeMutVar tc_env_var type_env -- Now do those rules and instances + ; let { rules | ignore_prags = [] + | otherwise = mi_rules iface + ; dfuns = mi_insts iface + } ; dfuns <- mapM tcIfaceInst dfuns ; rules <- mapM tcIfaceRule rules @@ -577,9 +566,9 @@ tcIfaceRule (IfaceBuiltinRule fn_rdr core_rule) ; returnM (IdCoreRule fn (isOrphNm fn_rdr) core_rule) } isOrphNm :: IfaceExtName -> Bool -isOrphNm (LocalTop _) = False -isOrphNm (LocalTopSub _ _) = False -isOrphNm other = True +-- An orphan name comes from somewhere other than this module, +-- so it has a non-local name +isOrphNm name = not (isLocalIfaceExtName name) \end{code}