[GHC] #13984: Panic when using a TH splice in a do bind pattern

GHC ghc-devs at haskell.org
Sun Jul 16 10:39:45 UTC 2017


#13984: Panic when using a TH splice in a do bind pattern
-------------------------------------+-------------------------------------
           Reporter:  mbieleck       |             Owner:  (none)
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:
          Component:  Compiler       |           Version:  8.2.1-rc3
           Keywords:  panic          |  Operating System:  Unknown/Multiple
  template-haskell                   |
       Architecture:                 |   Type of failure:  Compile-time
  Unknown/Multiple                   |  crash or panic
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 When compiling this file with HEAD
 (f656fba19d0cefe05643ddea35d080ea332a6584):

 {{{#!hs
 {-# 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.

-- 
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13984>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list