Commit 356e5e03 authored by Simon Peyton Jones's avatar Simon Peyton Jones

Do not eta-reduce across Ticks in CorePrep

The function tryEtaReducePrep was being over-ambitious.
When Breakpoint ticks were involved (i.e. in GHCi), eta
reduction left an out-of-scope variable in the Tick.

Easily fixed. Fixes the original report in Trac #111728.
parent 84dd9d0d
......@@ -967,8 +967,13 @@ tryEtaReducePrep bndrs (Let bind@(NonRec _ r) body)
where
fvs = exprFreeVars r
tryEtaReducePrep bndrs (Tick tickish e)
= fmap (mkTick tickish) $ tryEtaReducePrep bndrs e
-- NB: do not attempt to eta-reduce across ticks
-- Otherwise we risk reducing
-- \x. (Tick (Breakpoint {x}) f x)
-- ==> Tick (breakpoint {x}) f
-- which is bogus (Trac #17228)
-- tryEtaReducePrep bndrs (Tick tickish e)
-- = fmap (mkTick tickish) $ tryEtaReducePrep bndrs e
tryEtaReducePrep _ _ = Nothing
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment