InstEnv, ClsInstEnv, DFunId,
PackageInstEnv, PackageRuleBase,
- GlobalRdrEnv, RdrAvailInfo, pprGlobalRdrEnv,
+ GlobalRdrEnv, GlobalRdrElt(..), RdrAvailInfo, pprGlobalRdrEnv,
-- Provenance
Provenance(..), ImportReason(..),
lookupDeprec (DeprecSome env) name = case lookupNameEnv env name of
Just (_, txt) -> Just txt
Nothing -> Nothing
+
+instance Eq Deprecations where
+ -- Used when checking whether we need write a new interface
+ NoDeprecs == NoDeprecs = True
+ (DeprecAll t1) == (DeprecAll t2) = t1 == t2
+ (DeprecSome e1) == (DeprecSome e2) = nameEnvElts e1 == nameEnvElts e2
+ d1 == d2 = False
\end{code}
pcs_PRS :: PersistentRenamerState
}
-
\end{code}
The @PersistentRenamerState@ persists across successive calls to the
one for each module, corresponding to that module's top-level scope.
\begin{code}
-type GlobalRdrEnv = RdrNameEnv [(Name,Provenance)] -- The list is because there may be name clashes
- -- These only get reported on lookup,
- -- not on construction
+type GlobalRdrEnv = RdrNameEnv [GlobalRdrElt]
+ -- The list is because there may be name clashes
+ -- These only get reported on lookup, not on construction
+
+data GlobalRdrElt = GRE Name Provenance (Maybe DeprecTxt)
+ -- The Maybe DeprecTxt tells whether this name is deprecated
pprGlobalRdrEnv env
= vcat (map pp (rdrEnvToList env))
where
pp (rn, nps) = ppr rn <> colon <+>
- vcat [ppr n <+> pprNameProvenance n p | (n,p) <- nps]
+ vcat [ppr n <+> pprNameProvenance n p | (GRE n p _) <- nps]
\end{code}
The "provenance" of something says how it came to be in scope.
)
import CmdLineOpts
-import Id ( Id, idType, idInfo, isImplicitId, isDictFunId,
- idSpecialisation, setIdInfo, isLocalId, idName, hasNoBinding
+import Id ( idType, idInfo, isImplicitId, isDictFunId,
+ idSpecialisation, isLocalId, idName, hasNoBinding
)
import Var ( isId )
import VarSet
-- No old interface, so definitely write a new one!
= (new_iface, Just (text "No old interface available"))
-addVersionInfo (Just old_iface@(ModIface { mi_version = old_version,
- mi_decls = old_decls,
- mi_fixities = old_fixities }))
- new_iface@(ModIface { mi_decls = new_decls,
- mi_fixities = new_fixities })
+addVersionInfo (Just old_iface@(ModIface { mi_version = old_version,
+ mi_decls = old_decls,
+ mi_fixities = old_fixities,
+ mi_deprecs = old_deprecs }))
+ new_iface@(ModIface { mi_decls = new_decls,
+ mi_fixities = new_fixities,
+ mi_deprecs = new_deprecs })
| no_output_change && no_usage_change
= (new_iface, Nothing)
vers_rules = bumpVersion no_rule_change (vers_rules old_version),
vers_decls = tc_vers }
- no_output_change = no_tc_change && no_rule_change && no_export_change
+ no_output_change = no_tc_change && no_rule_change && no_export_change && no_deprec_change
no_usage_change = mi_usages old_iface == mi_usages new_iface
no_export_change = mi_exports old_iface == mi_exports new_iface -- Kept sorted
no_rule_change = dcl_rules old_decls == dcl_rules new_decls -- Ditto
+ no_deprec_change = old_deprecs == new_deprecs
-- Fill in the version number on the new declarations by looking at the old declarations.
-- Set the flag if anything changes.
pp_diffs = vcat [pp_tc_diffs,
pp_change no_export_change "Export list",
pp_change no_rule_change "Rules",
+ pp_change no_deprec_change "Deprecations",
pp_change no_usage_change "Usages"]
pp_change True what = empty
pp_change False what = text what <+> ptext SLIT("changed")
\begin{code}
module RnIfaces
(
- getInterfaceExports,
recordLocalSlurps,
mkImportInfo,
extractHsTyNames, extractHsCtxtTyNames,
tyClDeclFVs, ruleDeclFVs, instDeclFVs
)
-import RnHiFiles ( tryLoadInterface, loadHomeInterface, loadInterface,
+import RnHiFiles ( tryLoadInterface, loadHomeInterface,
loadOrphanModules
)
import RnSource ( rnTyClDecl, rnInstDecl, rnIfaceRuleDecl )
%*********************************************************
%* *
-\subsection{Getting what a module exports}
-%* *
-%*********************************************************
-
-@getInterfaceExports@ is called only for directly-imported modules.
-
-\begin{code}
-getInterfaceExports :: ModuleName -> WhereFrom -> RnMG (Module, [(ModuleName,Avails)])
-getInterfaceExports mod_name from
- = loadInterface doc_str mod_name from `thenRn` \ iface ->
- returnRn (mi_module iface, mi_exports iface)
- where
- doc_str = sep [ppr mod_name, ptext SLIT("is directly imported")]
-\end{code}
-
-
-%*********************************************************
-%* *
\subsection{Keeping track of what we've slurped, and version numbers}
%* *
%*********************************************************