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
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
pi_decls :: [(Version, RdrNameHsDecl)], -- Local definitions
pi_insts :: [RdrNameInstDecl], -- Local instance declarations
pi_rules :: [RdrNameRuleDecl], -- Rules
- pi_deprecs :: [(Maybe FAST_STRING, FAST_STRING)] -- Deprecations, the type is currently only a hack
+ pi_deprecs :: [RdrNameDeprecation] -- Deprecations
}
data InterfaceDetails
-- 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, 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 (