Commit 36f5406a authored by simonpj@microsoft.com's avatar simonpj@microsoft.com
Browse files

Improve error reporting in interface typechecking

parent a5168e30
......@@ -288,9 +288,10 @@ initOrigNames names = foldl extendOrigNameCache emptyModuleEnv names
tcIfaceLclId :: OccName -> IfL Id
tcIfaceLclId occ
= do { lcl <- getLclEnv
; return (lookupOccEnv (if_id_env lcl) occ
`orElse`
pprPanic "tcIfaceLclId" (ppr occ)) }
; case (lookupOccEnv (if_id_env lcl) occ) of
Just ty_var -> return ty_var
Nothing -> failIfM (text "Iface id out of scope: " <+> ppr occ)
}
refineIfaceIdEnv :: TypeRefinement -> IfL a -> IfL a
refineIfaceIdEnv (tv_subst, _) thing_inside
......@@ -311,9 +312,10 @@ extendIfaceIdEnv ids thing_inside
tcIfaceTyVar :: OccName -> IfL TyVar
tcIfaceTyVar occ
= do { lcl <- getLclEnv
; return (lookupOccEnv (if_tv_env lcl) occ
`orElse`
pprPanic "tcIfaceTyVar" (ppr occ)) }
; case (lookupOccEnv (if_tv_env lcl) occ) of
Just ty_var -> return ty_var
Nothing -> failIfM (text "Iface type variable out of scope: " <+> ppr occ)
}
extendIfaceTyVarEnv :: [TyVar] -> IfL a -> IfL a
extendIfaceTyVarEnv tyvars thing_inside
......
......@@ -654,7 +654,6 @@ toIfaceExpr ext (Lit l) = IfaceLit l
toIfaceExpr ext (Type ty) = IfaceType (toIfaceType ext ty)
toIfaceExpr ext (Lam x b) = IfaceLam (toIfaceBndr ext x) (toIfaceExpr ext b)
toIfaceExpr ext (App f a) = toIfaceApp ext f [a]
-- gaw 2004
toIfaceExpr ext (Case s x ty as) = IfaceCase (toIfaceExpr ext s) (getOccName x) (toIfaceType ext ty) (map (toIfaceAlt ext) as)
toIfaceExpr ext (Let b e) = IfaceLet (toIfaceBind ext b) (toIfaceExpr ext e)
toIfaceExpr ext (Note n e) = IfaceNote (toIfaceNote ext n) (toIfaceExpr ext e)
......
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