Skip to content

Panic with TemplateHaskell and duplicate indentifiers

This code causes GHC panic under 7.8.1-RC2:

{-# LANGUAGE TemplateHaskell #-}

module TXXXX where

$([d|
  foo :: a -> a
  foo x = x
 |])

foo :: a
foo = undefined
[killy@xerxes : /dane/projekty/sandbox/haskell] ghc -fforce-recomp TXXXX.hs
[1 of 1] Compiling TXXXX            ( TXXXX.hs, TXXXX.o )
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Loading package array-0.5.0.0 ... linking ... done.
Loading package deepseq-1.3.0.2 ... linking ... done.
Loading package containers-0.5.4.0 ... linking ... done.
Loading package pretty-1.1.1.1 ... linking ... done.
Loading package template-haskell ... linking ... done.
ghc: panic! (the 'impossible' happened)
  (GHC version 7.8.0.20140226 for x86_64-unknown-linux):
        lookupExactOcc
    foo_a2kL{v}
    [main:TXXXX.foo{v a2kL} defined at TXXXX.hs:11:1,
     main:TXXXX.foo{v a2kL} defined at TXXXX.hs:5:3]
Trac metadata
Trac field Value
Version 7.8.1-rc2
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Template Haskell
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