import HsSyn
import RdrHsSyn
-import RnHsSyn ( RenamedFixitySig )
+import RnHsSyn ( RenamedFixitySig, RenamedDeprecation )
import BasicTypes ( Version )
import SrcLoc ( noSrcLoc )
import ErrUtils ( addShortErrLocLine, addShortWarnLocLine,
)
import Name ( Name, OccName, NamedThing(..),
isLocallyDefinedName, nameModule, nameOccName,
- decode, mkLocalName
+ decode, mkLocalName, mkUnboundName
)
import Module ( Module, ModuleName, ModuleHiMap, SearchPath, WhereFrom,
mkModuleHiMaps, moduleName, mkVanillaModule, mkSearchPath
rn_ns :: IORef RnNameSupply,
rn_errs :: IORef (Bag WarnMsg, Bag ErrMsg),
rn_ifaces :: IORef Ifaces,
- rn_hi_maps :: (ModuleHiMap, -- for .hi files
+ rn_hi_maps :: (SearchPath, -- For error messages
+ ModuleHiMap, -- for .hi files
ModuleHiMap) -- for .hi-boot files
}
addToNameEnv_C :: (a->a->a) -> NameEnv a -> Name -> a -> NameEnv a
addToNameEnv :: NameEnv a -> Name -> a -> NameEnv a
plusNameEnv :: NameEnv a -> NameEnv a -> NameEnv a
+plusNameEnv_C :: (a->a->a) -> NameEnv a -> NameEnv a -> NameEnv a
extendNameEnv :: NameEnv a -> [(Name,a)] -> NameEnv a
lookupNameEnv :: NameEnv a -> Name -> Maybe a
delFromNameEnv :: NameEnv a -> Name -> NameEnv a
elemNameEnv :: Name -> NameEnv a -> Bool
+unitNameEnv :: Name -> a -> NameEnv a
emptyNameEnv = emptyUFM
nameEnvElts = eltsUFM
addToNameEnv_C = addToUFM_C
addToNameEnv = addToUFM
plusNameEnv = plusUFM
+plusNameEnv_C = plusUFM_C
extendNameEnv = addListToUFM
lookupNameEnv = lookupUFM
delFromNameEnv = delFromUFM
elemNameEnv = elemUFM
+unitNameEnv = unitUFM
--------------------------------
type FixityEnv = NameEnv RenamedFixitySig
-- We keep the whole fixity sig so that we
-- can report line-number info when there is a duplicate
-- fixity declaration
+
+--------------------------------
+type DeprecationEnv = NameEnv DeprecTxt
\end{code}
\begin{code}
-- Includes avails only from *unqualified* imports
-- (see 1.4 Report Section 5.1.1)
- NameEnv AvailInfo) -- Used to figure out all other export specifiers.
- -- Maps a Name to the AvailInfo that contains it
-
+ AvailEnv) -- Used to figure out all other export specifiers.
+
data GenAvailInfo name = Avail name -- An ordinary identifier
| AvailTC name -- The name of the type or class
-- to be in scope, it must be in this list.
-- Thus, typically: AvailTC Eq [Eq, ==, /=]
+type AvailEnv = NameEnv AvailInfo -- Maps a Name to the AvailInfo that contains it
type AvailInfo = GenAvailInfo Name
type RdrAvailInfo = GenAvailInfo OccName
\end{code}
type ExportItem = (ModuleName, [RdrAvailInfo])
type VersionInfo name = [ImportVersion name]
-type ImportVersion name = (ModuleName, Version, WhetherHasOrphans, WhatsImported name)
+type ImportVersion name = (ModuleName, Version,
+ WhetherHasOrphans, IsBootInterface, WhatsImported name)
type WhetherHasOrphans = Bool
-- An "orphan" is
-- * a transformation rule in a module other than the one defining
-- the function in the head of the rule.
+type IsBootInterface = Bool
+
data WhatsImported name = Everything
| Specifically [LocalVersion name] -- List guaranteed non-empty
data ParsedIface
= ParsedIface {
- pi_mod :: Version, -- Module version number
+ pi_mod :: Module, -- Complete with package info
+ pi_vers :: Version, -- Module version number
pi_orphan :: WhetherHasOrphans, -- Whether this module has orphans
pi_usages :: [ImportVersion OccName], -- Usages
pi_exports :: [ExportItem], -- Exports
pi_decls :: [(Version, RdrNameHsDecl)], -- Local definitions
pi_insts :: [RdrNameInstDecl], -- Local instance declarations
- pi_rules :: [RdrNameRuleDecl] -- Rules
+ pi_rules :: [RdrNameRuleDecl], -- Rules
+ pi_deprecs :: [RdrNameDeprecation] -- Deprecations
}
-type InterfaceDetails = (WhetherHasOrphans,
- VersionInfo Name, -- Version information for what this module imports
- ExportEnv) -- What modules this one depends on
+data InterfaceDetails
+ = InterfaceDetails WhetherHasOrphans
+ (VersionInfo Name) -- Version information for what this module imports
+ ExportEnv -- What modules this one depends on
+ [Deprecation Name]
-- needed by Main to fish out the fixities assoc list.
getIfaceFixities :: InterfaceDetails -> Fixities
-getIfaceFixities (_, _, ExportEnv _ fs _) = fs
+getIfaceFixities (InterfaceDetails _ _ (ExportEnv _ fs _) _) = fs
type RdrNamePragma = () -- Fudge for now
-- Each is 'gated' by the names that must be available before
-- this instance decl is needed.
- iRules :: Bag GatedDecl
+ iRules :: Bag GatedDecl,
-- Ditto transformation rules
+
+ iDeprecs :: DeprecationEnv
}
type GatedDecl = (NameSet, (Module, RdrNameHsDecl))
type ImportedModuleInfo
- = FiniteMap ModuleName (Version, Bool, Maybe (Module, Bool, Avails))
+ = FiniteMap ModuleName (Version, WhetherHasOrphans, IsBootInterface,
+ Maybe (Module, WhereFrom, Avails))
-- Suppose the domain element is module 'A'
--
-- The first Bool is True if A contains
-- and we don't want thereby to try to suck it in!
iVSlurp = [],
iInsts = emptyBag,
- iRules = emptyBag
+ iRules = emptyBag,
+ iDeprecs = emptyNameEnv
}
--- mkUnboundName makes a place-holder Name; it shouldn't be looked at except possibly
--- during compiler debugging.
-mkUnboundName :: RdrName -> Name
-mkUnboundName rdr_name = mkLocalName unboundKey (rdrNameOcc rdr_name) noSrcLoc
-
-isUnboundName :: Name -> Bool
-isUnboundName name = getUnique name == unboundKey
-
builtins :: FiniteMap (ModuleName,OccName) Name
builtins =
bagToFM (
setIfacesRn ifaces (RnDown {rn_ifaces = iface_var}) _
= writeIORef iface_var ifaces
-getHiMaps :: RnM d (ModuleHiMap, ModuleHiMap)
+getHiMaps :: RnM d (SearchPath, ModuleHiMap, ModuleHiMap)
getHiMaps (RnDown {rn_hi_maps = himaps}) _
= return himaps
\end{code}
-
-\begin{code}
-lookupModuleRn :: ModuleName -> RnM d Module
-lookupModuleRn x =
- getHiMaps `thenRn` \ (himap, _) ->
- case lookupFM himap x of
- Nothing -> returnRn (mkVanillaModule x)
- Just (_,x) -> returnRn x
-
\end{code}