Add a HsExplicitFlag to SpliceDecl, to improve Trac #4042
authorsimonpj@microsoft.com <unknown>
Thu, 6 May 2010 16:15:23 +0000 (16:15 +0000)
committersimonpj@microsoft.com <unknown>
Thu, 6 May 2010 16:15:23 +0000 (16:15 +0000)
commit302e2e29f2e1074bfba561e077a484dc4e1d15f6
treea5fc708696c16bb2a7fa446d0691cc1af904713c
parentc7c2a6b5ce0ea2fa010b193d059d4705a1791c40
Add a HsExplicitFlag to SpliceDecl, to improve Trac #4042

The issue here is that

    g :: A -> A
    f
    data A = A

is treated as if you'd written $(f); that is the call of
f is a top-level Template Haskell splice.  This patch
makes sure that we *first* check the -XTemplateHaskellFlag
and bleat about a parse error if it's off.  Othewise we
get strange seeing "A is out of scope" errors.
compiler/hsSyn/HsDecls.lhs
compiler/parser/RdrHsSyn.lhs
compiler/rename/RnExpr.lhs
compiler/rename/RnSource.lhs
compiler/typecheck/TcRnDriver.lhs