• Simon Peyton Jones's avatar
    Fix shadowing in mkWwBodies · 692c8df0
    Simon Peyton Jones authored
    This bug, exposed by Trac #12562 was very obscure, and has been
    lurking for a long time.  What happened was that, in the
    worker/wrapper split
    
      a tyvar binder for a worker function
      accidentally shadowed an in-scope term variable
      that was mentioned in the body of the function
    
    It's jolly hard to provoke, so I have not even attempted to make
    a test case.  There's a Note [Freshen WW arguments] to explain.
    
    Interestingly, fixing the bug (which meant fresher type variables)
    revealed a second lurking bug: I'd failed to apply the substitution to
    the coercion in the second last case of mkWWArgs, which introduces a
    Cast.
    692c8df0
WorkWrap.hs 20.2 KB