This BIG PATCH contains most of the work for the New Coercion Representation
[ghc-hetmet.git] / compiler / rename / RnBinds.lhs
index 4899adb..503953d 100644 (file)
@@ -357,7 +357,9 @@ rnLocalValBindsAndThen binds@(ValBindsIn _ sigs) thing_inside
                --      let x = x in 3
                -- should report 'x' unused
        ; let real_uses = findUses dus result_fvs
-       ; warnUnusedLocalBinds bound_names real_uses
+             -- Insert fake uses for variables introduced implicitly by wildcards (#4404)
+             implicit_uses = hsValBindsImplicits binds'
+       ; warnUnusedLocalBinds bound_names (real_uses `unionNameSets` implicit_uses)
 
        ; let
             -- The variables "used" in the val binds are: 
@@ -453,7 +455,7 @@ rnBind :: (Name -> [Name])          -- Signature tyvar function
 rnBind _ trim (L loc bind@(PatBind { pat_lhs = pat
                                    , pat_rhs = grhss 
                                       -- pat fvs were stored in bind_fvs
-                                      -- after processing the LHS          
+                                      -- after processing the LHS
                                    , bind_fvs = pat_fvs }))
   = setSrcSpan loc $ 
     do { let bndrs = collectPatBinders pat
@@ -473,7 +475,7 @@ rnBind sig_fn trim
                             , fun_infix = is_infix 
                             , fun_matches = matches })) 
        -- invariant: no free vars here when it's a FunBind
-  = setSrcSpan loc $ 
+  = setSrcSpan loc $
     do { let plain_name = unLoc name
 
        ; (matches', fvs) <- bindSigTyVarsFV (sig_fn plain_name) $
@@ -773,7 +775,7 @@ rnGRHS ctxt = wrapLocFstM (rnGRHS' ctxt)
 rnGRHS' :: HsMatchContext Name -> GRHS RdrName -> RnM (GRHS Name, FreeVars)
 rnGRHS' ctxt (GRHS guards rhs)
   = do { pattern_guards_allowed <- xoptM Opt_PatternGuards
-       ; ((guards', rhs'), fvs) <- rnStmts (PatGuard ctxt) guards $
+        ; ((guards', rhs'), fvs) <- rnStmts (PatGuard ctxt) guards $ \ _ ->
                                    rnLExpr rhs
 
        ; unless (pattern_guards_allowed || is_standard_guard guards')