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

GHC ghc-devs at haskell.org
Sun Jan 7 03:11:46 UTC 2018


#14630: name shadowing warnings by record pattern synonyms + RecordWildCards or
NamedFieldPuns
-------------------------------------+-------------------------------------
        Reporter:  mizunashi_mana    |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.2.2
      Resolution:                    |             Keywords:
                                     |  PatternSynonyms
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Incorrect         |  Unknown/Multiple
  error/warning at compile-time      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:  #11228            |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Changes (by RyanGlScott):

 * related:   => #11228


Comment:

 This is likely related in nature to #11228 (Interaction between ORF and
 record pattern synonyms needs to be resolved.), since `FldParent` is used
 to disambiguate duplicate record fields in the presence of
 `DuplicateRecordFields`. This means that this program will not compile:

 {{{#!hs
 {-# LANGUAGE DuplicateRecordFields #-}
 {-# LANGUAGE PatternSynonyms #-}
 module Bug where

 pattern Foo :: Int -> Int -> (Int, Int)
 pattern Foo {x, y} = (x, y)

 pattern Bar :: Int -> Int -> (Int, Int)
 pattern Bar {x, y} = (x, y)
 }}}

 Whereas if `x` and `y` were normal record selectors from a data type
 constructor, GHC would accept them.

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


More information about the ghc-tickets mailing list