Emit a decent error message when there is a decl-splice inside a decl-bracket
authorsimonpj@microsoft.com <unknown>
Fri, 23 Mar 2007 11:19:12 +0000 (11:19 +0000)
committersimonpj@microsoft.com <unknown>
Fri, 23 Mar 2007 11:19:12 +0000 (11:19 +0000)
commitd52ec21d7ef5dc077f406cd17e57116b9f83fa18
tree5edac0588f1d83cf3668b1486d6699eec4d570f6
parent20e4e3356fdb65a1010124d4c86319da9f2397fc
Emit a decent error message when there is a decl-splice inside a decl-bracket

This fixes Trac #1065.  The fix is just to emit a decent error message
rather than crash.  The situation is this:

  f x = ... [d| $(..stuff..);
                f x = v :: T |] ...

TH wants to rename and typecheck the bracket; but it can't run the
nested splice yet.  That seems hard, because we know nothing about v, T,
which are, presumably bound by the splice.

The original TH paper says this isn't allowed, and now it's checked for
properly (in the parser, in fact) rather than causing a crash.  In the
fullness of time we might want to do something more flexible, but not now.
compiler/parser/Parser.y.pp
compiler/parser/RdrHsSyn.lhs