[GHC] #9061: Warnings for redundant imports doesn't take name shadowing into account (Regression)

GHC ghc-devs at haskell.org
Thu May 1 12:32:06 UTC 2014


#9061: Warnings for redundant imports doesn't take name shadowing into account
(Regression)
-------------------------+-------------------------------------------------
       Reporter:         |             Owner:
  bergmark               |            Status:  new
           Type:  bug    |         Milestone:
       Priority:         |           Version:  7.8.2
  normal                 |  Operating System:  Unknown/Multiple
      Component:         |   Type of failure:  Incorrect warning at
  Compiler               |  compile-time
       Keywords:         |         Test Case:
   Architecture:         |          Blocking:
  Unknown/Multiple       |
     Difficulty:         |
  Unknown                |
     Blocked By:         |
Related Tickets:         |
-------------------------+-------------------------------------------------
 Reproduction:
 {{{
 module Log where

 import Prelude hiding (log)

 f :: ()
 f = log where log = ()
 }}}

 Compiling this with -Wall On GHC 7.8.2:
 {{{
 > ghc Log.hs -Wall
 [1 of 1] Compiling Log              ( Log.hs, Log.o )

 Log.hs:3:1: Warning:
     The import of ‘Prelude’ is redundant
       except perhaps to import instances from ‘Prelude’
     To import instances alone, use: import Prelude()
 }}}

 The suggestion is incorrect since removing the import statement gives the
 following warning:

 {{{
 Log.hs:4:15: Warning:
     This binding for ‘log’ shadows the existing binding
       imported from ‘Prelude’ at Log.hs:1:8-10
       (and originally defined in ‘GHC.Float’)
 }}}

 On GHC 7.6.3 the Reproduction does not give any warnings (which is
 correct).

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


More information about the ghc-tickets mailing list