Skip to content
  • Simon Peyton Jones's avatar
    Fix Trac #2188: scoping in TH declarations quotes · a27c5f77
    Simon Peyton Jones authored
    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.
    a27c5f77