Skip to content

Backpack: matching newtype selectors doesn't work

unit p where
    signature A where
        newtype F a = F { mkF :: a }
unit q where
    module A where
        newtype F a = F { mkF :: a }
unit r where
    dependency p[A=q:A]

fails with

ezyang@sabre:~$ ghc-head --backpack selector.bkp -dppr-debug
[1 of 3] Processing p
[2 of 3] Processing q
  Instantiating q
  [1 of 1] Compiling A                ( q/A.hs, q/A.o )
[3 of 3] Processing r
  Instantiating r
  [1 of 1] Including p[A=q:A]
    Instantiating p[A=q:A]
    [1 of 1] Compiling A[sig]           ( p/A.hsig, p/p-HVmFlcYSefiK5n1aDP1v7x/A.o )
ghc: panic! (the 'impossible' happened)
  (GHC version 8.1.20170123 for x86_64-unknown-linux):
	TcIface.find_lbl
  missing: mkF{v}
  known labels: [mkF{q:A.mkF{v rb}}]
  Call stack:
      CallStack (from HasCallStack):
        prettyCurrentCallStack, called at compiler/utils/Outputable.hs:1166:58 in ghc:Outputable
        callStackDoc, called at compiler/utils/Outputable.hs:1170:37 in ghc:Outputable
        pprPanic, called at compiler/iface/TcIface.hs:841:41 in ghc:TcIface
Trac metadata
Trac field Value
Version 8.1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler (Type checker)
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