X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=blobdiff_plain;f=compiler%2Fmain%2FHscTypes.lhs;h=2c6d426099e300f489f378d3e0a17c6a36b35259;hp=c9ea1f7c4fe3f62ef1498db3a4c59f784ad17f55;hb=6084fb5517da34f65034370a3695e2af3b85ce2b;hpb=25628e2771424cae1b3366322e8ce6f8a85440f9 diff --git a/compiler/main/HscTypes.lhs b/compiler/main/HscTypes.lhs index c9ea1f7..2c6d426 100644 --- a/compiler/main/HscTypes.lhs +++ b/compiler/main/HscTypes.lhs @@ -32,8 +32,8 @@ module HscTypes ( icPrintUnqual, mkPrintUnqualified, extendInteractiveContext, substInteractiveContext, - ModIface(..), mkIfaceDepCache, mkIfaceHashCache, mkIfaceFixCache, - emptyIfaceDepCache, + ModIface(..), mkIfaceWarnCache, mkIfaceHashCache, mkIfaceFixCache, + emptyIfaceWarnCache, FixityEnv, FixItem(..), lookupFixity, emptyFixityEnv, @@ -52,7 +52,7 @@ module HscTypes ( GenAvailInfo(..), AvailInfo, RdrAvailInfo, IfaceExport, - Deprecations(..), DeprecTxt, plusDeprecs, + Warnings(..), WarningTxt(..), plusWarns, PackageInstEnv, PackageRuleBase, @@ -90,7 +90,7 @@ import Rules ( RuleBase ) import CoreSyn ( CoreBind ) import VarEnv import VarSet -import Var hiding ( setIdType ) +import Var import Id import Type @@ -101,7 +101,7 @@ import PrelNames ( gHC_PRIM ) import Packages hiding ( Version(..) ) import DynFlags ( DynFlags(..), isOneShot, HscTarget (..) ) import DriverPhases ( HscSource(..), isHsBoot, hscSourceString, Phase ) -import BasicTypes ( IPName, Fixity, defaultFixity, DeprecTxt ) +import BasicTypes ( IPName, Fixity, defaultFixity, WarningTxt(..) ) import OptimizationFuel ( OptFuelState ) import IfaceSyn import FiniteMap ( FiniteMap ) @@ -206,6 +206,10 @@ data HscEnv -- by limiting the number of transformations, -- we can use binary search to help find compiler bugs. + hsc_type_env_var :: Maybe (Module, IORef TypeEnv), + -- Used for one-shot compilation only, to initialise + -- the IfGblEnv. See TcRnTypes.TcGblEnv.tcg_type_env_var + hsc_global_rdr_env :: GlobalRdrEnv, hsc_global_type_env :: TypeEnv } @@ -377,7 +381,7 @@ data FindResult | NoPackage PackageId -- the requested package was not found | FoundMultiple [PackageId] - -- *error*: both in multiple packages + -- _error_: both in multiple packages | PackageHidden PackageId -- for an explicit source import: the package containing the module is -- not exposed. @@ -441,8 +445,8 @@ data ModIface mi_fixities :: [(OccName,Fixity)], -- NOT STRICT! we read this field lazily from the interface file - -- Deprecations - mi_deprecs :: Deprecations, + -- Warnings + mi_warns :: Warnings, -- NOT STRICT! we read this field lazily from the interface file -- Type, class and variable declarations @@ -481,7 +485,7 @@ data ModIface -- Cached environments for easy lookup -- These are computed (lazily) from other fields -- and are not put into the interface file - mi_dep_fn :: Name -> Maybe DeprecTxt, -- Cached lookup for mi_deprecs + mi_warn_fn :: Name -> Maybe WarningTxt, -- Cached lookup for mi_warns mi_fix_fn :: OccName -> Fixity, -- Cached lookup for mi_fixities mi_hash_fn :: OccName -> Maybe (OccName, Fingerprint), -- Cached lookup for mi_decls @@ -542,7 +546,7 @@ data ModGuts mg_rules :: ![CoreRule], -- Rules from this module mg_binds :: ![CoreBind], -- Bindings for this module mg_foreign :: !ForeignStubs, - mg_deprecs :: !Deprecations, -- Deprecations declared in the module + mg_warns :: !Warnings, -- Warnings declared in the module mg_hpc_info :: !HpcInfo, -- info about coverage tick boxes mg_modBreaks :: !ModBreaks, mg_vect_info :: !VectInfo, -- Pool of vectorised declarations @@ -552,12 +556,12 @@ data ModGuts -- this module, rather than for *just* this module. -- Reason: when looking up an instance we don't want to have to -- look at each module in the home package in turn - mg_inst_env :: InstEnv, -- Class instance enviroment fro - -- *home-package* modules (including - -- this one); c.f. tcg_inst_env - mg_fam_inst_env :: FamInstEnv -- Type-family instance enviroment - -- for *home-package* modules (including - -- this one); c.f. tcg_fam_inst_env + mg_inst_env :: InstEnv, + -- ^ Class instance enviroment from /home-package/ modules (including + -- this one); c.f. tcg_inst_env + mg_fam_inst_env :: FamInstEnv + -- ^ Type-family instance enviroment for /home-package/ modules + -- (including this one); c.f. tcg_fam_inst_env } -- A CoreModule consists of just the fields of a ModGuts that are needed for @@ -652,7 +656,7 @@ emptyModIface mod mi_exports = [], mi_exp_hash = fingerprint0, mi_fixities = [], - mi_deprecs = NoDeprecs, + mi_warns = NoWarnings, mi_insts = [], mi_fam_insts = [], mi_rules = [], @@ -660,7 +664,7 @@ emptyModIface mod mi_globals = Nothing, mi_orphan_hash = fingerprint0, mi_vect_info = noIfaceVectInfo, - mi_dep_fn = emptyIfaceDepCache, + mi_warn_fn = emptyIfaceWarnCache, mi_fix_fn = emptyIfaceFixCache, mi_hash_fn = emptyIfaceHashCache, mi_hpc = False @@ -1000,11 +1004,11 @@ These types are defined here because they are mentioned in ModDetails, but they are mostly elaborated elsewhere \begin{code} ------------------- Deprecations ------------------------- -data Deprecations - = NoDeprecs - | DeprecAll DeprecTxt -- Whole module deprecated - | DeprecSome [(OccName,DeprecTxt)] -- Some specific things deprecated +------------------ Warnings ------------------------- +data Warnings + = NoWarnings + | WarnAll WarningTxt -- Whole module deprecated + | WarnSome [(OccName,WarningTxt)] -- Some specific things deprecated -- Only an OccName is needed because -- (1) a deprecation always applies to a binding -- defined in the module in which the deprecation appears. @@ -1027,20 +1031,20 @@ data Deprecations -- a Name to its fixity declaration. deriving( Eq ) -mkIfaceDepCache :: Deprecations -> Name -> Maybe DeprecTxt -mkIfaceDepCache NoDeprecs = \_ -> Nothing -mkIfaceDepCache (DeprecAll t) = \_ -> Just t -mkIfaceDepCache (DeprecSome pairs) = lookupOccEnv (mkOccEnv pairs) . nameOccName +mkIfaceWarnCache :: Warnings -> Name -> Maybe WarningTxt +mkIfaceWarnCache NoWarnings = \_ -> Nothing +mkIfaceWarnCache (WarnAll t) = \_ -> Just t +mkIfaceWarnCache (WarnSome pairs) = lookupOccEnv (mkOccEnv pairs) . nameOccName -emptyIfaceDepCache :: Name -> Maybe DeprecTxt -emptyIfaceDepCache _ = Nothing +emptyIfaceWarnCache :: Name -> Maybe WarningTxt +emptyIfaceWarnCache _ = Nothing -plusDeprecs :: Deprecations -> Deprecations -> Deprecations -plusDeprecs d NoDeprecs = d -plusDeprecs NoDeprecs d = d -plusDeprecs _ (DeprecAll t) = DeprecAll t -plusDeprecs (DeprecAll t) _ = DeprecAll t -plusDeprecs (DeprecSome v1) (DeprecSome v2) = DeprecSome (v1 ++ v2) +plusWarns :: Warnings -> Warnings -> Warnings +plusWarns d NoWarnings = d +plusWarns NoWarnings d = d +plusWarns _ (WarnAll t) = WarnAll t +plusWarns (WarnAll t) _ = WarnAll t +plusWarns (WarnSome v1) (WarnSome v2) = WarnSome (v1 ++ v2) \end{code} @@ -1226,7 +1230,7 @@ data ExternalPackageState -- * Fingerprint info -- * Its exports -- * Fixities - -- * Deprecations + -- * Warnings eps_PTE :: !PackageTypeEnv, -- Domain = external-package modules