-Weverything should not enable -Wmissing-exported-signatures
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@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@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)
Trac metadata
Trac field | Value |
---|---|
Version | 8.2.1 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |