Commit a0ba88be authored by Ian Lynagh's avatar Ian Lynagh
Browse files

Merge branch 'master' of darcs.haskell.org:/srv/darcs//ghc

parents 2844abb4 cfb038de
......@@ -11,6 +11,9 @@
--
-------------------------------------------------------------------------------
{-# OPTIONS_GHC -fno-warn-missing-fields #-}
-- So that tracingSettings works properly
module DynFlags (
-- * Dynamic flags and associated configuration types
DynFlag(..),
......@@ -998,6 +1001,7 @@ defaultDynFlags mySettings =
interactivePrint = Nothing
}
--------------------------------------------------------------------------
-- Do not use tracingDynFlags!
-- tracingDynFlags is a hack, necessary because we need to be able to
-- show SDocs when tracing, but we don't always have DynFlags available.
......@@ -1006,7 +1010,16 @@ defaultDynFlags mySettings =
-- undefined.
tracingDynFlags :: DynFlags
tracingDynFlags = defaultDynFlags tracingSettings
where tracingSettings = panic "Settings not defined in tracingDynFlags"
tracingSettings :: Settings
tracingSettings = trace "panic: Settings not defined in tracingDynFlags" $
Settings { sTargetPlatform = tracingPlatform }
-- Missing flags give a nice error
tracingPlatform :: Platform
tracingPlatform = Platform { platformWordSize = 4, platformOS = OSUnknown }
-- Missing flags give a nice error
--------------------------------------------------------------------------
type FatalMessager = String -> IO ()
type LogAction = DynFlags -> Severity -> SrcSpan -> PprStyle -> MsgDoc -> IO ()
......
......@@ -452,11 +452,14 @@ rnBind _ (L loc bind@(PatBind { pat_lhs = pat
-- Keep locally-defined Names
-- As well as dependency analysis, we need these for the
-- MonoLocalBinds test in TcBinds.decideGeneralisationPlan
bndrs = collectPatBinders pat
bind' = bind { pat_rhs = grhss', bind_fvs = fvs' }
; ifWOptM Opt_WarnUnusedBinds $
when (null bndrs) (addWarn $ unusedPatBindWarn bind')
; fvs' `seq` -- See Note [Free-variable space leak]
return (L loc (bind { pat_rhs = grhss'
, bind_fvs = fvs' }),
collectPatBinders pat, all_fvs) }
return (L loc bind', bndrs, all_fvs) }
rnBind sig_fn (L loc bind@(FunBind { fun_id = name
, fun_infix = is_infix
......@@ -854,4 +857,8 @@ nonStdGuardErr guards
= hang (ptext (sLit "accepting non-standard pattern guards (use -XPatternGuards to suppress this message)"))
4 (interpp'SP guards)
unusedPatBindWarn :: HsBind Name -> SDoc
unusedPatBindWarn bind
= hang (ptext (sLit "This pattern-binding binds no variables:"))
2 (ppr bind)
\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