Skip to content

Panic when exporting duplicate record fields from separate modules

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
Edited by Ben Gamari
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information