[GHC] #16305: When should -Wmissed-specializations fire?
GHC
ghc-devs at haskell.org
Tue Feb 12 12:24:59 UTC 2019
#16305: When should -Wmissed-specializations fire?
-------------------------------------+-------------------------------------
Reporter: crockeea | Owner: (none)
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 8.7
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
Type of failure: Poor/confusing | Unknown/Multiple
error message | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by simonpj):
As I read the code it is trying to do this:
* `-Wall-missed-specs`: warn about ''any'' overloaded imported functions
that cannot be specialised. Usually this means we don't have its RHS.
* `-Wmissed-specs`: warn about any overloaded imported functions that
can't be specialised, and is transitively called by a chain of imported
functions each with an INLINEABLE pragma.
For the latter consider
{{{
module A where
import B
foo = f (3::Int) + g (4::Int)
module B where
f :: Num a => a -> a
{-# INLINABLE f #-}
f x = h x
g x = Num a => a -> a
g x = blah
h x :: Num a => a -> a
h x = blah
}}}
Then when compiling A, `-Wmissed-specs` is supposed to
* Not warn about not-specialising `g`, because `g` didn't have an
INLINABLE pragma.
* Warn about non-specialising `h` because `f` (which is directly called
from A) has a careful `INLINABLE` pragma, but `h` (perhaps due to an
oversight) does not.
In contrast `-Wall-missed-specs` should warn about both.
Does that make sense? Is it what we want?
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/16305#comment:6>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list