[GHC] #14892: Field imposters with DuplicateRecordFields and NamedFieldPuns.

GHC ghc-devs at haskell.org
Mon Mar 5 17:19:08 UTC 2018


#14892: Field imposters with DuplicateRecordFields and NamedFieldPuns.
-------------------------------------+-------------------------------------
        Reporter:  philderbeast      |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.4.1-alpha3
      Resolution:                    |             Keywords:  ORF
Operating System:  MacOS X           |         Architecture:  x86_64
 Type of failure:  GHC accepts       |  (amd64)
  invalid program                    |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:  #13644            |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Changes (by RyanGlScott):

 * cc: adamgundry (added)
 * keywords:   => ORF
 * version:  8.2.2 => 8.4.1-alpha3
 * related:  13644 => #13644


Comment:

 FWIW, this does not panic on GHC 8.4.1 (after #13644 was fixed), but
 instead gives an incorrect error message:

 {{{
 $ /opt/ghc/8.4.1/bin/ghci GhcPanic12158.hs
 GHCi, version 8.4.0.20180224: http://www.haskell.org/ghc/  :? for help
 Loaded GHCi configuration from /home/rgscott/.ghci
 [1 of 2] Compiling Geodesy          ( Geodesy.hs, interpreted )
 [2 of 2] Compiling GhcPanic12158    ( GhcPanic12158.hs, interpreted )

 GhcPanic12158.hs:8:12: error:
     • Constructor ‘G.X’ does not have field ‘x’
     • In the pattern: G.X {x}
       In an equation for ‘update’: update G.X {x} = G.X {x = x}
   |
 8 | update G.X{x} = G.X{x = x}
   |            ^
 }}}

 I believe this lines up with Adam's work on overloaded record fields, so
 I'll label this ticket as such.

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


More information about the ghc-tickets mailing list