[GHC] #4877: Template Haskell panic when splicing an infix expression with a non-variable middle bit
GHC
cvs-ghc at haskell.org
Mon Jan 3 18:34:36 CET 2011
#4877: Template Haskell panic when splicing an infix expression with a non-
variable middle bit
---------------------------------+------------------------------------------
Reporter: benmachine | Owner:
Type: bug | Status: new
Priority: normal | Component: Template Haskell
Version: 7.0.1 | Keywords:
Testcase: | Blockedby:
Os: Unknown/Multiple | Blocking:
Architecture: Unknown/Multiple | Failure: Compile-time crash
---------------------------------+------------------------------------------
Simple enough:
{{{
import Language.Haskell.TH
import Language.Haskell.TH.Syntax
panic = $(let var = varE . mkName in infixApp (var "x") (appE (var "f")
(var "y")) (var "z"))
}}}
{{{
[1 of 1] Compiling Panic ( Panic.hs, interpreted )
ghc: panic! (the 'impossible' happened)
(GHC version 7.0.1 for i386-unknown-linux):
rnExpr: unexpected expression
{6:11-92}
f{v} y{v}
x{v} z{v}
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
}}}
Of course the expression being spliced doesn't make any sense. In fact,
I'd think that the only things that make sense in the centre of an infix
expression were a single variable or constructor, so that field being of
type Exp is arguably way too permissiveP. haskell-src seems to have a data
type especially for this purpose - `HsQOp` with constructors `HsQVarOp
HsQName` and `HsQConOp HsQName`.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/4877>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the Glasgow-haskell-bugs
mailing list