diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2012-07-23 09:17:53 +0100 |
---|---|---|
committer | Simon Peyton Jones <simonpj@microsoft.com> | 2012-07-23 09:17:53 +0100 |
commit | 4dac5452d15f5299597e1f9c7f138f950a4b5089 (patch) | |
tree | c48a556ecc280770c798d0fbb7ff90ab4b2cdaec | |
parent | fabb1551411701338e737c741300bdd47ad11f9c (diff) | |
parent | be86a8f7ea6caf184521cb7cf937edc53126e2d7 (diff) | |
download | haskell-4dac5452d15f5299597e1f9c7f138f950a4b5089.tar.gz |
Merge branch 'master' of darcs.haskell.org:/home/darcs/ghc
-rw-r--r-- | compiler/rename/RnBinds.lhs | 13 | ||||
-rw-r--r-- | compiler/typecheck/TcSMonad.lhs | 2 |
2 files changed, 12 insertions, 3 deletions
diff --git a/compiler/rename/RnBinds.lhs b/compiler/rename/RnBinds.lhs index 65df7ba196..75c49437c0 100644 --- a/compiler/rename/RnBinds.lhs +++ b/compiler/rename/RnBinds.lhs @@ -454,9 +454,18 @@ rnBind _ (L loc bind@(PatBind { pat_lhs = pat -- MonoLocalBinds test in TcBinds.decideGeneralisationPlan bndrs = collectPatBinders pat bind' = bind { pat_rhs = grhss', bind_fvs = fvs' } - + is_wild_pat = case pat of + L _ (WildPat {}) -> True + _ -> False + + -- Warn if the pattern binds no variables, except for the + -- entirely-explicit idiom _ = rhs + -- which (a) is not that different from _v = rhs + -- (b) is sometimes used to give a type sig for, + -- or an occurrence of, a variable on the RHS ; ifWOptM Opt_WarnUnusedBinds $ - when (null bndrs) (addWarn $ unusedPatBindWarn bind') + when (null bndrs && not is_wild_pat) $ + addWarn $ unusedPatBindWarn bind' ; fvs' `seq` -- See Note [Free-variable space leak] return (L loc bind', bndrs, all_fvs) } diff --git a/compiler/typecheck/TcSMonad.lhs b/compiler/typecheck/TcSMonad.lhs index 4073e4e6f8..9fb24064bc 100644 --- a/compiler/typecheck/TcSMonad.lhs +++ b/compiler/typecheck/TcSMonad.lhs @@ -1593,7 +1593,7 @@ matchClass clas tys ([], _unifs, _) -- Nothing matches -> do { traceTcS "matchClass not matching" $ vcat [ text "dict" <+> ppr pred - , ppr instEnvs ] + {- , ppr instEnvs -} ] ; return MatchInstNo } ; |