summaryrefslogtreecommitdiff
path: root/compiler/coreSyn/CorePrep.hs
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2016-03-25 09:23:17 +0000
committerSimon Peyton Jones <simonpj@microsoft.com>2016-03-25 09:30:18 +0000
commit356e5e03e63558019fd0571b6c462740aceb7810 (patch)
treef6e097bd98b726e93dcdf8400089c1d580b329d3 /compiler/coreSyn/CorePrep.hs
parent84dd9d0d4ccc904d64410b7f2c27ef79a5edd262 (diff)
downloadhaskell-356e5e03e63558019fd0571b6c462740aceb7810.tar.gz
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.
Diffstat (limited to 'compiler/coreSyn/CorePrep.hs')
-rw-r--r--compiler/coreSyn/CorePrep.hs9
1 files changed, 7 insertions, 2 deletions
diff --git a/compiler/coreSyn/CorePrep.hs b/compiler/coreSyn/CorePrep.hs
index 58eda2fb5c..fb00f2bb4b 100644
--- a/compiler/coreSyn/CorePrep.hs
+++ b/compiler/coreSyn/CorePrep.hs
@@ -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