[GHC] #13840: Pattern matching duplicated record fields

GHC ghc-devs at haskell.org
Sat Jun 17 10:10:31 UTC 2017


#13840: Pattern matching duplicated record fields
-------------------------------------+-------------------------------------
           Reporter:  lapdot         |             Owner:  (none)
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:
          Component:  Compiler       |           Version:  8.0.2
           Keywords:                 |  Operating System:  Linux
       Architecture:  x86_64         |   Type of failure:  Compile-time
  (amd64)                            |  crash or panic
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 GHC panic during compiling pattern matching with duplicated record fields.
 The following is a short example.

 Main module:
 {{{#!hs
 module Lib
     ( someFunc
     ) where

 import F1
 import qualified F2

 r :: F2.T2
 r = F2.T2 {
   F2.foo = "ok"
 }

 someFunc :: IO ()
 someFunc = case r of
   F2.T2{ foo = a } -> putStrLn a
 }}}

 The first submodule:
 {{{#!hs
 module F1
     ( T1(..)
     ) where

 newtype T1 = T1 {
   foo :: String
 }
 }}}

 The second submodule:
 {{{#!hs
 module F2
     ( T2(..)
     ) where

 newtype T2 = T2 {
   foo :: String
 }
 }}}

 GHC compiles the modules successfully if uses DuplicateRecordFields.

 The modules may be not correct without DuplicateRecordFields. But GHC
 should show an error message other than panic.

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


More information about the ghc-tickets mailing list