[GHC] #10908: -fwarn-missing-exported-sigs doesn't respect qualified names

GHC ghc-devs at haskell.org
Mon Oct 12 16:37:32 UTC 2015


#10908: -fwarn-missing-exported-sigs doesn't respect qualified names
-------------------------------------+-------------------------------------
        Reporter:  goldfire          |                Owner:
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  7.10.2
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Incorrect         |  Unknown/Multiple
  warning at compile-time            |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Old description:

> Trying to help @mpickering with Phab:D1258, I looked at the code in
> `tcRnSrcDecls` and was surprised to see that exports are renamed after
> this function is complete. This didn't make any sense to me. And, indeed,
> it's wrong, witness by this example:
>
> {{{
> {-# OPTIONS_GHC -fwarn-missing-exported-sigs #-}
>
> module Bug (Data.List.intercalate, x) where
>
> import qualified Data.List
>
> intercalate = True
>
> x :: Bool
> x = intercalate
> }}}
>
> This produces
>
> {{{
> Bug.hs:7:1: Warning:
>     Top-level binding with no type signature: intercalate :: Bool
> }}}
>
> This warning should not be emitted.
>
> I'm not all that concerned about this scenario biting in the wild, but it
> suggests that refactoring this code is a good thing, and not something
> Phab:D1258 should take pains to avoid.

New description:

 Trying to help @mpickering with Phab:D1258, I looked at the code in
 `tcRnSrcDecls` and was surprised to see that exports are renamed after
 this function is complete. This didn't make any sense to me. And, indeed,
 it's wrong, witness by this example:

 {{{
 {-# OPTIONS_GHC -fwarn-missing-exported-sigs #-}

 module Bug (Data.List.intercalate, x) where

 import qualified Data.List

 intercalate = True

 x :: Bool
 x = intercalate
 }}}

 This produces

 {{{
 Bug.hs:7:1: Warning:
     Top-level binding with no type signature: intercalate :: Bool
 }}}

 This warning should not be emitted, because `Bug.intercalate` is not
 exported.

 I'm not all that concerned about this scenario biting in the wild, but it
 suggests that refactoring this code is a good thing, and not something
 Phab:D1258 should take pains to avoid.

--

Comment (by simonpj):

 Quite right.  I think the right thing is to remove all the `sig_warn`
 stuff from `TcHsSyn` (zonking; it doesn't belong there) and put it in
 `reportUnusedNames` (perhaps with a better function name).

 Simon

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


More information about the ghc-tickets mailing list