[GHC] #10908: -fwarn-missing-exported-sigs doesn't respect qualified names
#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 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: Incorrect Unknown/Multiple | warning at compile-time Test Case: | Blocked By: Blocking: | Related Tickets: Differential Revisions: | -------------------------------------+------------------------------------- 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. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10908> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#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 Revisions: -------------------------------------+------------------------------------- Changes (by thomie): * cc: gridaphobe (added) Comment: CC @gridaphobe as the author of `-fwarn-missing-exported-sigs`. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10908#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#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
#10908: -fwarn-missing-exported-sigs doesn't respect qualified names -------------------------------------+------------------------------------- Reporter: goldfire | Owner: Type: bug | Status: patch 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): Phab:D1561 Wiki Page: | -------------------------------------+------------------------------------- Changes (by gridaphobe): * status: new => patch * differential: => Phab:D1561 -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10908#comment:3> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#10908: -fwarn-missing-exported-sigs doesn't respect qualified names -------------------------------------+------------------------------------- Reporter: goldfire | Owner: Type: bug | Status: patch 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): Phab:D1561 Wiki Page: | -------------------------------------+------------------------------------- Comment (by Ben Gamari <ben@…>): In [changeset:"1bd40c860eb0e8da55b8eff536766a6c802347cc/ghc" 1bd40c8/ghc]: {{{ #!CommitTicketReference repository="ghc" revision="1bd40c860eb0e8da55b8eff536766a6c802347cc" Move checking for missing signatures to RnNames.reportUnusedNames Checking for missing signatures before renaming the export list is prone to errors, so we now perform the check in `reportUnusedNames` at which point everything has been renamed. Test Plan: validate, new test case is T10908 Reviewers: goldfire, simonpj, austin, bgamari Subscribers: thomie Projects: #ghc Differential Revision: https://phabricator.haskell.org/D1561 GHC Trac Issues: #10908 }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10908#comment:4> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#10908: -fwarn-missing-exported-sigs doesn't respect qualified names -------------------------------------+------------------------------------- Reporter: goldfire | Owner: Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 7.10.2 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Incorrect | Test Case: warning at compile-time | warnings/should_compile/T10908 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D1561 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * testcase: => warnings/should_compile/T10908 * status: patch => closed * resolution: => fixed -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10908#comment:5> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#10908: -fwarn-missing-exported-sigs doesn't respect qualified names -------------------------------------+------------------------------------- Reporter: goldfire | Owner: Type: bug | Status: closed Priority: normal | Milestone: 8.0.1 Component: Compiler | Version: 7.10.2 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Incorrect | Test Case: warning at compile-time | warnings/should_compile/T10908 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D1561 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * milestone: => 8.0.1 -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10908#comment:6> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (1)
-
GHC