- 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 ****
= 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})
import CmdLineOpts ( DynFlag(..) )
-- Warn of unused for-all'd tyvars
import Maybes ( maybeToBool )
+import Maybe ( maybe )
\end{code}
@rnSourceDecl@ `renames' declarations.
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}