Commit 6104e5eb authored by simonpj@microsoft.com's avatar simonpj@microsoft.com
Browse files

Buglet in tcIface, now that nested binders can have pragmas

This fix ties the knot for recursive groups properly
parent 42fe1649
...@@ -871,20 +871,32 @@ tcIfaceExpr (IfaceCase scrut case_bndr ty alts) = do ...@@ -871,20 +871,32 @@ tcIfaceExpr (IfaceCase scrut case_bndr ty alts) = do
ty' <- tcIfaceType ty ty' <- tcIfaceType ty
return (Case scrut' case_bndr' ty' alts') return (Case scrut' case_bndr' ty' alts')
tcIfaceExpr (IfaceLet (IfaceNonRec bndr rhs) body) = do tcIfaceExpr (IfaceLet (IfaceNonRec (IfLetBndr fs ty info) rhs) body)
rhs' <- tcIfaceExpr rhs = do { name <- newIfaceName (mkVarOccFS fs)
id <- tcIfaceLetBndr bndr ; ty' <- tcIfaceType ty
body' <- extendIfaceIdEnv [id] (tcIfaceExpr body) ; id_info <- tcIdInfo False {- Don't ignore prags; we are inside one! -}
return (Let (NonRec id rhs') body') name ty' info
; let id = mkLocalIdWithInfo name ty' id_info
tcIfaceExpr (IfaceLet (IfaceRec pairs) body) = do ; rhs' <- tcIfaceExpr rhs
ids <- mapM tcIfaceLetBndr bndrs ; body' <- extendIfaceIdEnv [id] (tcIfaceExpr body)
extendIfaceIdEnv ids $ do ; return (Let (NonRec id rhs') body') }
rhss' <- mapM tcIfaceExpr rhss
body' <- tcIfaceExpr body tcIfaceExpr (IfaceLet (IfaceRec pairs) body)
return (Let (Rec (ids `zip` rhss')) body') = do { ids <- mapM tc_rec_bndr (map fst pairs)
where ; extendIfaceIdEnv ids $ do
(bndrs, rhss) = unzip pairs { pairs' <- zipWithM tc_pair pairs ids
; body' <- tcIfaceExpr body
; return (Let (Rec pairs') body') } }
where
tc_rec_bndr (IfLetBndr fs ty _)
= do { name <- newIfaceName (mkVarOccFS fs)
; ty' <- tcIfaceType ty
; return (mkLocalId name ty') }
tc_pair (IfLetBndr _ _ info, rhs) id
= do { rhs' <- tcIfaceExpr rhs
; id_info <- tcIdInfo False {- Don't ignore prags; we are inside one! -}
(idName id) (idType id) info
; return (setIdInfo id id_info, rhs') }
tcIfaceExpr (IfaceCast expr co) = do tcIfaceExpr (IfaceCast expr co) = do
expr' <- tcIfaceExpr expr expr' <- tcIfaceExpr expr
...@@ -1236,16 +1248,6 @@ bindIfaceBndrs (b:bs) thing_inside ...@@ -1236,16 +1248,6 @@ bindIfaceBndrs (b:bs) thing_inside
bindIfaceBndrs bs $ \ bs' -> bindIfaceBndrs bs $ \ bs' ->
thing_inside (b':bs') thing_inside (b':bs')
-----------------------
tcIfaceLetBndr :: IfaceLetBndr -> IfL Id
tcIfaceLetBndr (IfLetBndr fs ty info)
= do { name <- newIfaceName (mkVarOccFS fs)
; ty' <- tcIfaceType ty
; id_info <- tcIdInfo False {- Don't ignore prags; we are inside one! -}
name ty' info
; return (mkLocalIdWithInfo name ty' id_info) }
----------------------- -----------------------
newExtCoreBndr :: IfaceLetBndr -> IfL Id newExtCoreBndr :: IfaceLetBndr -> IfL Id
newExtCoreBndr (IfLetBndr var ty _) -- Ignoring IdInfo for now newExtCoreBndr (IfLetBndr var ty _) -- Ignoring IdInfo for now
......
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