Commit 6e8861c9 authored by Simon Peyton Jones's avatar Simon Peyton Jones
Browse files

Use IfLclName instead of OccName in IfaceEqSpec

The type variables in the IfaceEqSpec of a data constructor are really
ordinarly *occurrences*, so they should be IfLclNames just like any
other type variable occurence.
parent b4856f9f
......@@ -16,7 +16,7 @@ module IfaceSyn (
module IfaceType,
IfaceDecl(..), IfaceSynTyConRhs(..), IfaceClassOp(..), IfaceAT(..),
IfaceConDecl(..), IfaceConDecls(..),
IfaceConDecl(..), IfaceConDecls(..), IfaceEqSpec,
IfaceExpr(..), IfaceAlt, IfaceLetBndr(..),
IfaceBinding(..), IfaceConAlt(..),
IfaceIdInfo(..), IfaceIdDetails(..), IfaceUnfolding(..),
......@@ -405,7 +405,7 @@ data IfaceConDecl
ifConStricts :: [IfaceBang]} -- Empty (meaning all lazy),
-- or 1-1 corresp with arg tys
type IfaceEqSpec = [(OccName,IfaceType)]
type IfaceEqSpec = [(IfLclName,IfaceType)]
instance HasOccName IfaceConDecl where
occName = ifConOcc
......@@ -1183,7 +1183,7 @@ pprIfaceDecl ss (IfaceData { ifName = tycon, ifCType = ctype,
mk_user_con_res_ty univ_tvs eq_spec
= (filterOut done_univ_tv univ_tvs, sdocWithDynFlags pp_res_ty)
where
gadt_env = mkFsEnv [(occNameFS occ, ty) | (occ,ty) <- eq_spec]
gadt_env = mkFsEnv eq_spec
done_univ_tv (tv,_) = isJust (lookupFsEnv gadt_env tv)
pp_res_ty dflags
......
......@@ -15,7 +15,7 @@ module IfaceType (
IfaceContext, IfaceBndr(..), IfaceTvBndr, IfaceIdBndr,
-- Conversion from Type -> IfaceType
toIfaceType, toIfaceTypes, toIfaceKind,
toIfaceType, toIfaceTypes, toIfaceKind, toIfaceTyVar,
toIfaceContext, toIfaceBndr, toIfaceIdBndr,
toIfaceTvBndrs, toIfaceTyCon, toIfaceTyCon_name,
toIfaceTcArgs,
......
......@@ -1646,7 +1646,7 @@ tyConToIfaceDecl env tycon
ifConWrapper = isJust (dataConWrapId_maybe data_con),
ifConUnivTvs = toIfaceTvBndrs univ_tvs',
ifConExTvs = toIfaceTvBndrs ex_tvs',
ifConEqSpec = to_eq_spec eq_spec,
ifConEqSpec = map to_eq_spec eq_spec,
ifConCtxt = tidyToIfaceContext env2 theta,
ifConArgTys = map (tidyToIfaceType env2) arg_tys,
ifConFields = map getOccName
......@@ -1659,8 +1659,7 @@ tyConToIfaceDecl env tycon
-- data constructor is fully standalone
(env1, univ_tvs') = tidyTyVarBndrs emptyTidyEnv univ_tvs
(env2, ex_tvs') = tidyTyVarBndrs env1 ex_tvs
to_eq_spec spec = [ (getOccName (tidyTyVar env2 tv), tidyToIfaceType env2 ty)
| (tv,ty) <- spec]
to_eq_spec (tv,ty) = (toIfaceTyVar (tidyTyVar env2 tv), tidyToIfaceType env2 ty)
toIfaceBang :: TidyEnv -> HsBang -> IfaceBang
toIfaceBang _ HsNoBang = IfNoBang
......
......@@ -673,11 +673,11 @@ tcIfaceDataCons tycon_name tycon _ if_cons
tc_strict (IfUnpackCo if_co) = do { co <- tcIfaceCo if_co
; return (HsUnpack (Just co)) }
tcIfaceEqSpec :: [(OccName, IfaceType)] -> IfL [(TyVar, Type)]
tcIfaceEqSpec :: IfaceEqSpec -> IfL [(TyVar, Type)]
tcIfaceEqSpec spec
= mapM do_item spec
where
do_item (occ, if_ty) = do { tv <- tcIfaceTyVar (occNameFS occ)
do_item (occ, if_ty) = do { tv <- tcIfaceTyVar occ
; ty <- tcIfaceType if_ty
; return (tv,ty) }
\end{code}
......
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