[GHC] #15110: Exitification abstracts over shadowed variables

GHC ghc-devs at haskell.org
Tue May 1 21:56:22 UTC 2018


#15110: Exitification abstracts over shadowed variables
-------------------------------------+-------------------------------------
        Reporter:  nomeata           |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:  8.6.1
       Component:  Compiler          |              Version:  8.5
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by simonpj):

 Ha, quite true -- although you give me too much credit for spotting it.

 NB: in your explanation (which should end up in a Note, be sure to point
 out that Core distinguishes variables by their `Unique` so their `OccName`
 is irrelevant.  What you write should be understood to mean that the two
 `x`'s are variable with the same `Unique`, rather than with the same
 `OccName`.  It's difficult to make this happen, and the Simplifier removes
 such shadowing, but yes, it's valid.

 Easy fix:
 {{{
 abs_vars = map zap proto_abs_vars
 (proto_abs_vars, _) = foldr add ([], fvs) captured
 add v (acc, fvs) = (acc', fvs `delVarSet` b)
   where
     acc' | v `elemVarSet` fvs = v : acc
          | otherwise          = acc
 }}}

-- 
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15110#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list