Commit 37a47dd0 authored by keithw's avatar keithw
Browse files

[project @ 2002-02-06 12:12:25 by keithw]

Merging the following onto the HEAD:

|   1.61.2.1  +2 -4      fptools/ghc/compiler/rename/RnHsSyn.lhs
|   1.135.2.1 +10 -0     fptools/ghc/compiler/rename/RnSource.lhs

Original comment (keithw):

Remove derivings FVs from tyClDeclFVs, because they aren't needed by
interface files.  Instead, we return these FVs from
finishSourceTyClDecl.
parent c19b2904
......@@ -114,6 +114,7 @@ In all cases this is set up for interface-file declarations:
- for class decls we ignore the bindings
- for instance decls likewise, plus the pragmas
- for rule decls, we ignore HsRules
- for data decls, we ignore derivings
*** See "THE NAMING STORY" in HsDecls ****
......@@ -126,12 +127,9 @@ tyClDeclFVs (IfaceSig {tcdType = ty, tcdIdInfo = id_infos})
= extractHsTyNames ty `plusFV`
plusFVs (map hsIdInfoFVs id_infos)
tyClDeclFVs (TyData {tcdCtxt = context, tcdTyVars = tyvars, tcdCons = condecls, tcdDerivs = derivings})
tyClDeclFVs (TyData {tcdCtxt = context, tcdTyVars = tyvars, tcdCons = condecls})
= delFVs (map hsTyVarName tyvars) $
extractHsCtxtTyNames context `plusFV`
(case derivings of
Nothing -> emptyFVs
Just ds -> extractHsCtxtTyNames ds) `plusFV`
plusFVs (map conDeclFVs condecls)
tyClDeclFVs (TySynonym {tcdTyVars = tyvars, tcdSynRhs = ty})
......
......@@ -45,6 +45,7 @@ import SrcLoc ( SrcLoc )
import CmdLineOpts ( DynFlag(..) )
-- Warn of unused for-all'd tyvars
import Maybes ( maybeToBool )
import Maybe ( maybe )
\end{code}
@rnSourceDecl@ `renames' declarations.
......@@ -433,6 +434,15 @@ finishSourceTyClDecl (ClassDecl {tcdMeths = Just mbinds, tcdLoc = src_loc}) -- G
where
meth_doc = text "In the default-methods for class" <+> ppr (tcdName rn_cls_decl)
finishSourceTyClDecl _ tycl_decl@(TyData {tcdDerivs = derivings})
-- Derivings are returned here so that they don't form part of the tyClDeclFVs.
-- This is important, because tyClDeclFVs should contain only the
-- FVs that are `needed' by the interface file declaration, and
-- derivings do not appear in this. It also means that the tcGroups
-- are smaller, which turned out to be important for the usage inference. KSW 2002-02.
= returnRn (tycl_decl,
maybe emptyFVs extractHsCtxtTyNames derivings)
finishSourceTyClDecl _ tycl_decl = returnRn (tycl_decl, emptyFVs)
-- Not a class declaration
\end{code}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment