diff options
author | simonpj@microsoft.com <unknown> | 2009-05-27 18:21:57 +0000 |
---|---|---|
committer | simonpj@microsoft.com <unknown> | 2009-05-27 18:21:57 +0000 |
commit | 685f631451c4e6d8ebb6e31decb935db675f338e (patch) | |
tree | 305632e3842b639075c3504b2e2b602a54f95bcd /compiler/rename | |
parent | 389cca214f33a29646e08d57e3dca862140007b2 (diff) | |
download | haskell-685f631451c4e6d8ebb6e31decb935db675f338e.tar.gz |
Fix Trac #3221: renamer warnings for deriving clauses
This patch arranges to gather the variables used by 'deriving' clauses,
so that unused bindings are correctly reported.
Diffstat (limited to 'compiler/rename')
-rw-r--r-- | compiler/rename/RnSource.lhs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/compiler/rename/RnSource.lhs b/compiler/rename/RnSource.lhs index 442d4652d6..5a071ee2e2 100644 --- a/compiler/rename/RnSource.lhs +++ b/compiler/rename/RnSource.lhs @@ -216,6 +216,8 @@ rnTyClDecls tycl_decls = do (decls', _fvs) <- rnList rnTyClDecl tycl_decls return decls' addTcgDUs :: TcGblEnv -> DefUses -> TcGblEnv +-- This function could be defined lower down in the module hierarchy, +-- but there doesn't seem anywhere very logical to put it. addTcgDUs tcg_env dus = tcg_env { tcg_dus = tcg_dus tcg_env `plusDU` dus } rnList :: (a -> RnM (b, FreeVars)) -> [Located a] -> RnM ([Located b], FreeVars) @@ -659,10 +661,10 @@ rnTyClDecl (tydecl@TyData {tcdND = new_or_data, tcdCtxt = context, else lookupLocatedTopBndrRn tycon ; context' <- rnContext data_doc context ; typats' <- rnTyPats data_doc typatsMaybe - ; (derivs', deriv_fvs) <- rn_derivs derivs ; condecls' <- rnConDecls (unLoc tycon') condecls -- No need to check for duplicate constructor decls -- since that is done by RnNames.extendGlobalRdrEnvRn + ; (derivs', deriv_fvs) <- rn_derivs derivs ; return (TyData {tcdND = new_or_data, tcdCtxt = context', tcdLName = tycon', tcdTyVars = tyvars', tcdTyPats = typats', tcdKindSig = Nothing, @@ -689,11 +691,11 @@ rnTyClDecl (tydecl@TyData {tcdND = new_or_data, tcdCtxt = context, -- do not scope over the constructor signatures -- data T a where { T1 :: forall b. b-> b } - ; (derivs', deriv_fvs) <- rn_derivs derivs ; condecls' <- rnConDecls (unLoc tycon') condecls -- No need to check for duplicate constructor decls -- since that is done by RnNames.extendGlobalRdrEnvRn + ; (derivs', deriv_fvs) <- rn_derivs derivs ; return (TyData {tcdND = new_or_data, tcdCtxt = noLoc [], tcdLName = tycon', tcdTyVars = tyvars', tcdTyPats = typats', tcdKindSig = sig, |