diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2011-06-16 14:23:08 +0100 |
---|---|---|
committer | Simon Peyton Jones <simonpj@microsoft.com> | 2011-06-16 14:23:08 +0100 |
commit | e3dcc0d5a9f805518f004a9ef42b3405b013a083 (patch) | |
tree | 7f4ea1edd1c003f4543c9848ee2306b0091f5cac /compiler/rename/RnBinds.lhs | |
parent | 9d5e65c4b10157b94a9745b2bfbe51f4e6fc616f (diff) | |
download | haskell-e3dcc0d5a9f805518f004a9ef42b3405b013a083.tar.gz |
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.)
Diffstat (limited to 'compiler/rename/RnBinds.lhs')
-rw-r--r-- | compiler/rename/RnBinds.lhs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/compiler/rename/RnBinds.lhs b/compiler/rename/RnBinds.lhs index 80a47a4ff6..04270de636 100644 --- a/compiler/rename/RnBinds.lhs +++ b/compiler/rename/RnBinds.lhs @@ -251,7 +251,13 @@ rnLocalValBindsLHS :: MiniFixityEnv -> HsValBinds RdrName -> RnM ([Name], HsValBindsLR Name RdrName) rnLocalValBindsLHS fix_env binds - = do { -- Do error checking: we need to check for dups here because we + = do { binds' <- rnValBindsLHS (localRecNameMaker fix_env) binds + + -- Check for duplicates and shadowing + -- Must do this *after* renaming the patterns + -- See Note [Collect binders only after renaming] in HsUtils + + -- We need to check for dups here because we -- don't don't bind all of the variables from the ValBinds at once -- with bindLocatedLocals any more. -- @@ -265,10 +271,10 @@ rnLocalValBindsLHS fix_env binds -- import A(f) -- g = let f = ... in f -- should. - ; binds' <- rnValBindsLHS (localRecNameMaker fix_env) binds ; let bound_names = collectHsValBinders binds' ; envs <- getRdrEnvs ; checkDupAndShadowedNames envs bound_names + ; return (bound_names, binds') } -- renames the left-hand sides |