Skip to content

DisambiguateRecordFields with qualified import can cause panic

When I'm using DisambiguateRecordFields with GHC 7.2.1 RC1 (7.2.0.20110728), I encounter panic.

module M where
data S = MkS { x :: Int, y :: Bool }
{-# LANGUAGE DisambiguateRecordFields #-}
module Foo where
import qualified M
notScope (MkS { x = n }) = n

This code causes panic when using GHC 7.2.1 RC1, and GHC 7.3.20110802.

 (snip)
[1 of 2] Compiling M                ( M.hs, interpreted )
[2 of 2] Compiling Foo              ( Test.hs, interpreted )
ghc.exe: panic! (the 'impossible' happened)
  (GHC version 7.3.20110802 for i386-unknown-mingw32):
        find_tycon
    MkS{d 02A}
    []

Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug

>

This problem is caused by using DisambiguateRecordFields extention. When I remove DisambiguateRecordFields extention from Foo module, GHC doesn't cause panic.

module Foo where
import qualified M
notScope (MkS { x = n }) = n
> :r
[2 of 2] Compiling Foo              ( Test.hs, interpreted )

Test.hs:4:11:
    Not in scope: data constructor `MkS'
    Perhaps you meant `M.MkS' (imported from M)

Test.hs:4:17: `x' is not a (visible) field of constructor `MkS'
Failed, modules loaded: M.
*M>

GHC 7.0.4 doesn't cause panic even though using DisambiguateRecordFields extention.

[1 of 2] Compiling M                ( M.hs, interpreted )
[2 of 2] Compiling Foo              ( Test.hs, interpreted )

Test.hs:4:11: Not in scope: data constructor `MkS'

Test.hs:4:17: `x' is not a (visible) field of constructor `MkS'
Failed, modules loaded: M.

So, I think this problem comes from 5d89565b .

Trac metadata
Trac field Value
Version 7.3
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information