Commit 707ea588 authored by's avatar
Browse files

For a non-recursive let, make sure we extend the value environment

This has been wrong for a long time.  Fixes Trac #4431.
parent fa1ac897
......@@ -958,13 +958,17 @@ scExpr' env (Let (NonRec bndr rhs) body)
| isTyCoVar bndr -- Type-lets may be created by doBeta
= scExpr' (extendScSubst env bndr rhs) body
| otherwise -- Note [Local let bindings]
| otherwise
= do { let (body_env, bndr') = extendBndr env bndr
body_env2 = extendHowBound body_env [bndr'] RecFun
; (body_usg, body') <- scExpr body_env2 body
; (rhs_usg, rhs_info) <- scRecRhs env (bndr',rhs)
; let body_env2 = extendHowBound body_env [bndr'] RecFun
-- Note [Local let bindings]
RI _ rhs' _ _ _ = rhs_info
body_env3 = extendValEnv body_env2 bndr' (isValue (sc_vals env) rhs')
; (body_usg, body') <- scExpr body_env3 body
-- NB: We don't use the ForceSpecConstr mechanism (see
-- Note [Forcing specialisation]) for non-recursive bindings
-- at the moment. I'm not sure if this is the right thing to do.
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