Opened 6 months ago

Last modified 6 months ago

#14627 new bug

qAddTopDecls: can't convert top-level declarations

Reported by: tianxiaogu Owned by:
Priority: normal Milestone:
Component: Template Haskell Version: 8.2.2
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Compile-time crash or panic Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description

The following program crashes 8.2.2 and HEAD (8.5.20171228).

{-# LANGUAGE TemplateHaskell #-}
import           Language.Haskell.TH.Syntax         (addTopDecls)
$(do
    ds <- [d| f = Bool
            |]
    addTopDecls ds
    [d| g = cab
      |])

Output:

    Exception when trying to run compile-time code:
      ghc: panic! (the 'impossible' happened)
  (GHC version 8.5.20171228 for x86_64-unknown-linux):
	qAddTopDecls: can't convert top-level declarations

Illegal variable name: ‘Bool’
When splicing a TH declaration: f_0 = Bool
Call stack:
    CallStack (from HasCallStack):
      callStackDoc, called at compiler/utils/Outputable.hs:1150:37 in ghc:Outputable
      pprPanic, called at compiler/typecheck/TcSplice.hs:886:27 in ghc:TcSplice

Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug

Change History (1)

comment:1 Changed 6 months ago by RyanGlScott

Architecture: x86_64 (amd64)Unknown/Multiple
Component: CompilerTemplate Haskell
Operating System: LinuxUnknown/Multiple
Note: See TracTickets for help on using tickets.