[GHC] #14630: name shadowing warnings by record pattern synonyms + RecordWildCards or NamedFieldPuns

GHC ghc-devs at haskell.org
Wed Jan 3 12:56:35 UTC 2018


#14630: name shadowing warnings by record pattern synonyms + RecordWildCards or
NamedFieldPuns
-------------------------------------+-------------------------------------
           Reporter:                 |             Owner:  (none)
  mizunashi_mana                     |
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:
          Component:  Compiler       |           Version:  8.2.2
           Keywords:                 |  Operating System:  Unknown/Multiple
  PatternSynonyms                    |
       Architecture:                 |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 When I use PatternSynonyms + RecordWildCards/NamedFieldPuns, I get name
 shadowing warnings.  I am hoping that these warnings don't trigger in the
 below case.

 {{{#!hs
 {-# LANGUAGE PatternSynonyms #-}
 {-# LANGUAGE RecordWildCards #-}
 {-# LANGUAGE NamedFieldPuns  #-}

 module TestPatternSynonyms where

 pattern Tuple :: a -> b -> (a, b)
 pattern Tuple{x, y} = (x, y)

 {-# COMPLETE Tuple #-}

 f :: (a, b) -> a
 f Tuple{x} = x
 {- warning: [-Wname-shadowing]
     This binding for ‘x’ shadows the existing binding
 -}

 g :: (Int, Int) -> Int
 g Tuple{..} = x + y
 {- warning: [-Wname-shadowing]
     This binding for ‘x’ shadows the existing binding
     This binding for ‘y’ shadows the existing binding
 -}
 }}}

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


More information about the ghc-tickets mailing list