From 5f9bd6b8297d4674cd19a18896c61b7c7b17c800 Mon Sep 17 00:00:00 2001 From: Neil Brown Date: Thu, 20 Nov 2008 14:31:29 +0000 Subject: [PATCH] Fixed checkUnusedVar to also remove the unused variable from the compiler state --- checks/Check.hs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/checks/Check.hs b/checks/Check.hs index d0ecb64..5e4519a 100644 --- a/checks/Check.hs +++ b/checks/Check.hs @@ -23,6 +23,7 @@ with this program. If not, see . module Check (checkInitVarPass, usageCheckPass, checkUnusedVar) where import Control.Monad.Identity +import Control.Monad.State import Control.Monad.Trans import Data.Generics import Data.Graph.Inductive @@ -284,6 +285,7 @@ checkUnusedVar = forAnyASTStruct doSpec do -- TODO have a more general way of not warning about compiler-generated names: when (not $ "_sizes" `isSuffixOf` A.nameName name) $ warnPC mspec WarnUnusedVariable $ formatCode "Unused variable: %" name + modify (\st -> st { csNames = Map.delete (A.nameName name) (csNames st) }) substitute scope doSpec _ = return ()