Panic when using a TH splice in a do bind pattern
When compiling this file with HEAD (f656fba1):
{-# LANGUAGE TemplateHaskell #-}
module Panic where
import Language.Haskell.TH
expr :: IO Exp
expr = runQ $ do
name <- newName "foo"
[| do $(varP name) <- pure (); pure () |]
I get this message:
[1 of 1] Compiling Panic ( Panic.hs, Panic.o )
ghc-stage2: panic! (the 'impossible' happened)
(GHC version 8.3.20170713 for x86_64-unknown-linux):
isIrrefutableHsPat:
$(varP name)
Call stack:
CallStack (from HasCallStack):
prettyCurrentCallStack, called at compiler/utils/Outputable.hs:1133:58 in ghc:Outputable
callStackDoc, called at compiler/utils/Outputable.hs:1137:37 in ghc:Outputable
pprPanic, called at compiler/hsSyn/HsPat.hs:643:15 in ghc:HsPat
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
It compiles normally with GHC 8.2.1-rc2 (20170507). The bug exists in rc3 (20170704). I am unable to perform a more precise bisect.
Trac metadata
| Trac field | Value |
|---|---|
| Version | 8.2.1-rc3 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture |