[GHC] #11606: name shadowing warnings don't trigger on standalone declarations in ghci

GHC ghc-devs at haskell.org
Thu Dec 27 08:29:05 UTC 2018


#11606: name shadowing warnings don't trigger on standalone declarations in ghci
-------------------------------------+-------------------------------------
        Reporter:  rwbarton          |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  high              |            Milestone:  8.4.1
       Component:  GHCi              |              Version:  7.10.3
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:  #16096            |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Changes (by osa1):

 * owner:  rwbarton => (none)
 * related:   => #16096


Comment:

 My fix for #16096 (Phab:D5473) which treats `x = y` as `let x = y` fixes
 this:

 {{{
 ~ $ ghc-stage2 --interactive -Wall
 GHCi, version 8.7.20181226: https://www.haskell.org/ghc/  :? for help
 Loaded GHCi configuration from /home/omer/rcbackup/.ghci
 λ:1> x = 1
 λ:2> x = 1

 <interactive>:2:1: warning: [-Wname-shadowing]
     This binding for ‘x’ shadows the existing binding
       defined at <interactive>:1:1
 λ:3> let x = 1

 <interactive>:3:5: warning: [-Wname-shadowing]
     This binding for ‘x’ shadows the existing binding
       defined at <interactive>:2:1
 λ:4> x <- return ()

 <interactive>:4:1: warning: [-Wname-shadowing]
     This binding for ‘x’ shadows the existing binding
       defined at <interactive>:3:5
 }}}

 If we merge it we should add a test and close this.

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


More information about the ghc-tickets mailing list