A combination of DuplicateRecordFields and import hiding triggers a GHC panic
Summary
GHC panics with:
ghc: panic! (the 'impossible' happened)
(GHC version 8.6.3 for x86_64-apple-darwin):
filterImports/combine
(field, field, Nothing)
($sel:field:R, R{R, R; field}, Nothing)
Call stack:
CallStack (from HasCallStack):
callStackDoc, called at compiler/utils/Outputable.hs:1160:37 in ghc:Outputable
pprPanic, called at compiler/rename/RnNames.hs:901:23 in ghc:RnNames
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
Steps to reproduce
A.hs
:
module Main where
import B hiding (field)
main = print "ok"
B.hs
:
{-# LANGUAGE DuplicateRecordFields #-}
module B
( R(..)
, module C
) where
import C
data R = R { field :: Int}
C.hs
:
module C where
field = (++ "foo")
Expected behavior
compile time error instead of ghc panic
Environment
- GHC version used: 8.6.3
Optional:
- Operating System: OS X Sierra
- System Architecture: x86_64