• simonpj@microsoft.com's avatar
    Refactor part of the renamer to fix Trac #3901 · f1cc3eb9
    simonpj@microsoft.com authored
    This one was bigger than I anticipated!  The problem was that were
    were gathering the binders from a pattern before renaming -- but with
    record wild-cards we don't know what variables are bound by C {..}
    until after the renamer has filled in the "..".
    So this patch does the following
    * Change all the collect-X-Binders functions in HsUtils so that
      they expect to only be called *after* renaming.  That means they
      don't need to return [Located id] but just [id].  Which turned out
      to be a very worthwhile simplification all by itself.
    * Refactor the renamer, and in ptic RnExpr.rnStmt, so that it
      doesn't need to use collectLStmtsBinders on pre-renamed Stmts.
    * This in turn required me to understand how GroupStmt and
      TransformStmts were renamed.  Quite fiddly. I rewrote most of it;
      result is much shorter.
    * In doing so I flattened HsExpr.GroupByClause into its parent
      GroupStmt, with trivial knock-on effects in other files.
RnBinds.lhs 31.5 KB