Fix Trac #2188: scoping in TH declarations quotes
authorsimonpj@microsoft.com <unknown>
Fri, 4 Apr 2008 20:55:56 +0000 (20:55 +0000)
committersimonpj@microsoft.com <unknown>
Fri, 4 Apr 2008 20:55:56 +0000 (20:55 +0000)
commita27c5f77da8b3b3f00f9902b69a504460f234e8c
treec67fe72697cd465d532ad6970c0de90c758f0a05
parent3e571a94c03015f2c38c8d2f0f6dfb91c8d4413c
Fix Trac #2188: scoping in TH declarations quotes

This patch fixes a rather tiresome issue, namely the fact that
a TH declaration quote *shadows* bindings in outer scopes:

  f g = [d| f :: Int
            f = g
       g :: Int
            g = 4 |]

Here, the outer bindings for 'f' (top-level) and 'g' (local)
are shadowed, and the inner bindings for f,g should not be
reported as duplicates.  (Remember they are top-level bindings.)

The actual bug was that we'd forgotten to delete 'g' from the
LocalRdrEnv, so the type sig for 'g' was binding to the outer
'g' not the inner one.
compiler/rename/RnBinds.lhs
compiler/rename/RnEnv.lhs
compiler/rename/RnExpr.lhs
compiler/rename/RnNames.lhs
compiler/rename/RnPat.lhs
compiler/rename/RnSource.lhs
compiler/typecheck/TcRnDriver.lhs