[GHC] #14953: Panic when exporting duplicate record fields from separate modules

GHC ghc-devs at haskell.org
Mon Mar 26 01:08:47 UTC 2018


#14953: Panic when exporting duplicate record fields from separate modules
-------------------------------------+-------------------------------------
        Reporter:  lyxia             |                Owner:  (none)
            Type:  bug               |               Status:  closed
        Priority:  normal            |            Milestone:  8.6.1
       Component:  Compiler          |              Version:  8.5
      Resolution:  fixed             |             Keywords:  ORF
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  Compile-time      |            Test Case:
  crash or panic                     |  overloadedrecflds/should_fail/T14953
      Blocked By:                    |             Blocking:
 Related Tickets:  #13352            |  Differential Rev(s):  Phab:D4527
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Changes (by bgamari):

 * status:  patch => closed
 * resolution:   => fixed


Old description:

> `A.hs`
>
> {{{
> {-# LANGUAGE DuplicateRecordFields #-}
> module A where
> data R = R {unR :: Int}
> }}}
>
> ---
>
> `B.hs`
>
> {{{
> {-# LANGUAGE DuplicateRecordFields #-}
> module B where
> data R = R {unR :: Int}
> }}}
>
> ---
>
> `C.hs`
>
> {{{
> {-# LANGUAGE DuplicateRecordFields #-}
>
> module C (module A, module B) where
>
> import A
> import B
> }}}
>
> ---
>
> Output of `ghc C.hs`:
>
> {{{
> C.hs:3:21: error:ghc-stage2: panic! (the 'impossible' happened)
>   (GHC version 8.5.20180224 for x86_64-unknown-linux):
>         exportClashErr
>   $sel:unR:R
>   Call stack:
>       CallStack (from HasCallStack):
>         callStackDoc, called at compiler/utils/Outputable.hs:1150:37 in
> ghc:Outputable
>         pprPanic, called at compiler/typecheck/TcRnExports.hs:740:22 in
> ghc:TcRnExports
>
> }}}

New description:

 `A.hs`

 {{{#!hs
 {-# LANGUAGE DuplicateRecordFields #-}
 module A where
 data R = R {unR :: Int}
 }}}

 ---

 `B.hs`

 {{{#!hs
 {-# LANGUAGE DuplicateRecordFields #-}
 module B where
 data R = R {unR :: Int}
 }}}

 ---

 `C.hs`

 {{{#!hs
 {-# LANGUAGE DuplicateRecordFields #-}

 module C (module A, module B) where

 import A
 import B
 }}}

 ---

 Output of `ghc C.hs`:

 {{{
 C.hs:3:21: error:ghc-stage2: panic! (the 'impossible' happened)
   (GHC version 8.5.20180224 for x86_64-unknown-linux):
         exportClashErr
   $sel:unR:R
   Call stack:
       CallStack (from HasCallStack):
         callStackDoc, called at compiler/utils/Outputable.hs:1150:37 in
 ghc:Outputable
         pprPanic, called at compiler/typecheck/TcRnExports.hs:740:22 in
 ghc:TcRnExports

 }}}

--

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


More information about the ghc-tickets mailing list