patch applied (ghc): Fix Trac #2188: scoping in TH declarations quotes

Simon Peyton Jones simonpj at microsoft.com
Sat Apr 5 05:23:00 EDT 2008


Fri Apr  4 13:55:56 PDT 2008  simonpj at microsoft.com
  * 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.
  

    M ./compiler/rename/RnBinds.lhs -27 +15
    M ./compiler/rename/RnEnv.lhs -5 +12
    M ./compiler/rename/RnExpr.lhs -5 +2
    M ./compiler/rename/RnNames.lhs -80 +78
    M ./compiler/rename/RnPat.lhs -4 +1
    M ./compiler/rename/RnSource.lhs -18 +16
    M ./compiler/typecheck/TcRnDriver.lhs -3 +4



More information about the Cvs-ghc mailing list