Commit 5943a1ad authored by simonpj's avatar simonpj
Browse files

[project @ 2003-10-20 14:02:19 by simonpj]

Suppress renamer warnings (such as unused variables) when
renaming stuff generated by 'deriving' code.
parent 5565aed7
......@@ -248,8 +248,9 @@ deriveOrdinaryStuff eqns
; tcg_env <- getGblEnv
; let gen_binds = mkGenericBinds (typeEnvTyCons (tcg_type_env tcg_env))
-- Rename these extra bindings
; (rn_binds, _fvs1) <- rnTopMonoBinds (extra_binds `AndMonoBinds` gen_binds) []
-- Rename these extra bindings, discarding warnings about unused bindings etc
; (rn_binds, _fvs1) <- discardWarnings $
rnTopMonoBinds (extra_binds `AndMonoBinds` gen_binds) []
; let all_binds = rn_binds `ThenBinds`
foldr ThenBinds EmptyBinds aux_binds_s
......
......@@ -403,6 +403,18 @@ addMessages (m_warns, m_errs)
(warns, errs) <- readMutVar errs_var ;
writeMutVar errs_var (warns `unionBags` m_warns,
errs `unionBags` m_errs) }
discardWarnings :: TcRn a -> TcRn a
-- Ignore warnings inside the thing inside;
-- used to ignore-unused-variable warnings inside derived code
-- With -dppr-debug, the effects is switched off, so you can still see
-- what warnings derived code would give
discardWarnings thing_inside
= do { errs_var <- newMutVar emptyMessages
; result <- setErrsVar errs_var thing_inside
; (_warns, errs) <- readMutVar errs_var
; addMessages (emptyBag, errs)
; return result }
\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