[GHC] #15270: TH doesn't verify name types during conversion

GHC ghc-devs at haskell.org
Sat Jun 16 18:37:58 UTC 2018


#15270: TH doesn't verify name types during conversion
-------------------------------------+-------------------------------------
        Reporter:  bgamari           |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:  8.6.1
       Component:  Template Haskell  |              Version:  8.4.3
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by RyanGlScott):

 Actually, I think your hypothesis wasn't too far off, bgamari. Here's a
 minimal example which triggers the panic:

 {{{#!hs
 {-# LANGUAGE TemplateHaskell #-}
 module Bug where

 import Language.Haskell.TH.Lib
 import Language.Haskell.TH.Syntax

 main :: IO ()
 main = print $(conE (mkNameG_v "ghc-prim" "GHC.Types" "True"))
 }}}
 {{{
 $ ghc/inplace/bin/ghc-stage2 Bug2.hs
 [1 of 1] Compiling Bug              ( Bug2.hs, Bug2.o )
 ghc-stage2: panic! (the 'impossible' happened)
   (GHC version 8.5.20180616 for x86_64-unknown-linux):
         ASSERT failed!
   True
   Call stack:
       CallStack (from HasCallStack):
         callStackDoc, called at compiler/utils/Outputable.hs:1164:37 in
 ghc:Outputable
         pprPanic, called at compiler/utils/Outputable.hs:1223:5 in
 ghc:Outputable
         assertPprPanic, called at compiler/typecheck/TcHsSyn.hs:655:67 in
 ghc:TcHsSyn
 }}}

 It turns out that I was using `conE (mkNameG_v "ghc-prim" "GHC.Types"
 "True")` in `deriving-compat`. Oops!

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


More information about the ghc-tickets mailing list