Commit 0a5fb012 authored by simonmar's avatar simonmar

[project @ 2000-12-15 14:48:09 by simonmar]

Don't eta reduce something we just saturated.  (D'oh!)

This fixes the problem which causes a bootstrapped HEAD compiler to
crash.
parent c868a913
......@@ -334,7 +334,8 @@ deLam expr@(Lam _ _)
(bndrs, body) = collectBinders expr
eta expr@(App _ _)
| n_remaining >= 0 &&
| ok_to_eta_reduce f &&
n_remaining >= 0 &&
and (zipWith ok bndrs last_args) &&
not (any (`elemVarSet` fvs_remaining) bndrs)
= Just remaining_expr
......@@ -348,6 +349,14 @@ deLam expr@(Lam _ _)
ok bndr (Var arg) = bndr == arg
ok bndr other = False
-- we can't eta reduce something which must be saturated.
ok_to_eta_reduce (Var f)
= case idFlavour f of
PrimOpId op -> False
DataConId dc -> False
other -> True
ok_to_eta_reduce _ = False --safe. ToDo: generalise
eta (Let bind@(NonRec b r) body)
| not (any (`elemVarSet` fvs) bndrs)
= case eta body of
......
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