[GHC] #14794: -Weverything should not enable -Wmissing-exported-signatures

GHC ghc-devs at haskell.org
Mon Feb 12 00:56:49 UTC 2018


#14794: -Weverything should not enable -Wmissing-exported-signatures
-------------------------------------+-------------------------------------
           Reporter:  MaxGabriel     |             Owner:  (none)
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:
          Component:  Compiler       |           Version:  8.2.1
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  Incorrect
  Unknown/Multiple                   |  error/warning at compile-time
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 The `-Weverything` compiler flag enables every compiler warning. That
 includes `-Wmissing-exported-signatures`, which disables `-Wmissing-
 signatures` (With `-Wmissing-signatures`, every top-level binding without
 a signature generates a warning, with `-Wmissing-exported-signatures`,
 only exported bindings generate a warning).

 While technically "every warning" includes `-Wmissing-exported-
 signatures`, I don't think this matches how people use `-Weverything`. At
 least personally I think of it as "`-Wall` isn't enough, give me the
 strictest possible warning settings", but actually `-Weverything` can have
 ''fewer'' warnings than `-Wall` because of `-Wmissing-exported-
 signatures`.

 Example reproduction case:

 {{{
 -- Main.hs
 {-# LANGUAGE Safe #-}

 module Main (main) where

 import Prelude (IO, putStrLn, show, ($))
 import Foo (foo)

 main :: IO ()
 main = putStrLn $ show foo

 }}}

 {{{
 -- Foo.hs
 {-# LANGUAGE Safe #-}

 module Foo (foo) where

 import Prelude (Integer)

 foo :: Integer
 foo = bar

 bar = (1 :: Integer)
 }}}

 Expected: when compiling with `-Weverything`, I get a superset of
 `-Wall`'s warnings. Actual:

 Actual `-Wall`:

 {{{
 maximiliantagher at Maximilians-MacBook-Pro ~/D/C/H/ghc-warning> ghc -Wall
 Main.hs Foo.hs
 [1 of 2] Compiling Foo              ( Foo.hs, Foo.o )

 Foo.hs:10:1: warning: [-Wmissing-signatures]
     Top-level binding with no type signature: bar :: Integer
    |
 10 | bar = (1 :: Integer)
    | ^^^
 [2 of 2] Compiling Main             ( Main.hs, Main.o )
 Linking Main ...
 }}}

 Actual `-Weverything` (note: you should remove run `rm main.o main.hi main
 Foo.o Foo.hi` in between invocations of the ghc to avoid it using
 something pre-built):

 {{{
 maximiliantagher at Maximilians-MacBook-Pro ~/D/C/H/ghc-warning> ghc
 -Weverything Main.hs Foo.hs
 [1 of 2] Compiling Foo              ( Foo.hs, Foo.o )

 <no location info>: warning: [-Wsafe]
     ‘Foo’ has been inferred as safe!
 [2 of 2] Compiling Main             ( Main.hs, Main.o )

 <no location info>: warning: [-Wsafe]
     ‘Main’ has been inferred as safe!
 Linking Main ...
 }}}

 (I'm not familiar enough with Safe Haskell to get those warnings to go
 away—I tried the SafeHaskell pragma but that didn't seem to work. In any
 case, unrelated to this issue)

 I tested with these versions:

 * GHC: The Glorious Glasgow Haskell Compilation System, version 8.2.1
 * OS Version: Mac OS 10.13.3 (17D47) (High Sierra)

-- 
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14794>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list