#5037: TH mkName bug
-------------------------------+--------------------------------------------
Reporter: igloo | Owner:
Type: bug | Status: closed
Priority: normal | Milestone: 7.4.1
Component: Template Haskell | Version: 7.0.2
Resolution: fixed | Keywords:
Testcase: th/T5037 | Blockedby:
Difficulty: | Os: Unknown/Multiple
Blocking: | Architecture: Unknown/Multiple
Failure: None/Unknown |
-------------------------------+--------------------------------------------
Changes (by simonpj):
* status: new => closed
* testcase: => th/T5037
* resolution: => fixed
Comment:
Fixed by
{{{
commit e3dcc0d5a9f805518f004a9ef42b3405b013a083
Author: Simon Peyton Jones <[email protected]>
Date: Thu Jun 16 14:23:08 2011 +0100
Re-do (again) the handling of binders in Template Haskell
See the long Note [Binders in Template Haskell] in Convert.lhs
which explains it all. This patch fixes Trac #5037.
The key change is that NameU binders (ones made up by newName in
Template Haskell, and by TH quotations) now make Exact RdrNames again,
rather than making RdrNames with heavily encoded OccNames like
x[03cv].
(This encoding is what was making #5037 fail.)
compiler/hsSyn/Convert.lhs | 100
+++++++++++++++++++++++++++++++------------
compiler/iface/IfaceEnv.lhs | 2 +-
compiler/rename/RnBinds.lhs | 10 +++-
compiler/rename/RnEnv.lhs | 35 +++++++++------
compiler/rename/RnPat.lhs | 15 ++++---
5 files changed, 113 insertions(+), 49 deletions(-)
}}}
The relevant comment from `Convert` is
{{{
data (Exact (system Name "T")) = (Exact (system Name "MkT")) ...
So RnEnv.newGlobalBinder we spot Exact RdrNames that wrap a
non-External Name, and make an External name for. (Remember,
constructors and the like need External Names.) Oddly, the
*occurrences* will continue to be that (non-External) System Name,
but that will come out in the wash.
}}}
Test added.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5037#comment:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs