Skip to content

Passing -fno-code disables reporting of some warnings

Here is how to reproduce the issue with GHC 8.2.2:

$ cat Main.hs
module Main (main) where

main =
  case (1+1) :: Int of
    1 -> return ()


$ ghc -Wall -Werror -fno-code Main.hs
[1 of 1] Compiling Main             ( Main.hs, nothing )

Main.hs:3:1: warning: [-Wmissing-signatures]
    Top-level binding with no type signature: main :: IO ()
  |
3 | main =
  | ^^^^

<no location info>: error: 
Failing due to -Werror.


$ ghc -Wall -Werror Main.hs
[1 of 1] Compiling Main             ( Main.hs, Main.o )

Main.hs:3:1: warning: [-Wmissing-signatures]
    Top-level binding with no type signature: main :: IO ()
  |
3 | main =
  | ^^^^

Main.hs:4:3: warning: [-Wincomplete-patterns]
    Pattern match(es) are non-exhaustive
    In a case alternative:
        Patterns not matched: p where p is not one of {1}
  |
4 |   case (1+1) :: Int of
  |   ^^^^^^^^^^^^^^^^^^^^...

<no location info>: error: 
Failing due to -Werror.

Note that missing-signature is reported both times, but the incomplete-patterns is not reported with -fno-code.

Trac metadata
Trac field Value
Version 8.2.2
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information