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