diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2012-10-29 23:25:25 +0000 |
---|---|---|
committer | Simon Peyton Jones <simonpj@microsoft.com> | 2012-10-29 23:25:25 +0000 |
commit | 910a642294eb3547d0cbb3d5735ad81b964f137b (patch) | |
tree | 73af8af49ebd4de7411f9f32ab206944245de9c4 /ghc | |
parent | f8c23ff396eb3552b74d8045db28aa96ab519596 (diff) | |
download | haskell-910a642294eb3547d0cbb3d5735ad81b964f137b.tar.gz |
Do not treat a constructor in a *pattern* as a *use* of that constructor
Occurrences in terms are uses, in patterns they are not.
In this way we get unused-constructor warnings from modules like this
module M( f, g, T ) where
data T = T1 | T2 Bool
f x = T2 x
g T1 = True
g (T2 x) = x
Here a T1 value cannot be constructed, so we can warn. The use
in a pattern doesn't count. See Note [Patterns are not uses]
in RnPat.
Interestingly this change exposed three module in GHC itself
that had unused constructors, which I duly removed:
* ghc/Main.hs
* compiler/ghci/ByteCodeAsm
* compiler/nativeGen/PPC/RegInfo
Their changes are in this patch.
Diffstat (limited to 'ghc')
-rw-r--r-- | ghc/Main.hs | 2 |
1 files changed, 0 insertions, 2 deletions
diff --git a/ghc/Main.hs b/ghc/Main.hs index f05ddab7f6..a84f2ac140 100644 --- a/ghc/Main.hs +++ b/ghc/Main.hs @@ -110,7 +110,6 @@ main = do ShowSupportedExtensions -> showSupportedExtensions ShowVersion -> showVersion ShowNumVersion -> putStrLn cProjectVersion - Print str -> putStrLn str Right postStartupMode -> -- start our GHC session GHC.runGhc mbMinusB $ do @@ -361,7 +360,6 @@ data PreStartupMode = ShowVersion -- ghc -V/--version | ShowNumVersion -- ghc --numeric-version | ShowSupportedExtensions -- ghc --supported-extensions - | Print String -- ghc --print-foo showVersionMode, showNumVersionMode, showSupportedExtensionsMode :: Mode showVersionMode = mkPreStartupMode ShowVersion |