Commit 1bf423f5 authored by Simon Marlow's avatar Simon Marlow
Browse files

Fix #2334: tyvar binders can have Names inside (equality predicates)

parent ddd8dea0
...@@ -663,13 +663,16 @@ freeNamesIfDecl (IfaceId _s t i) = ...@@ -663,13 +663,16 @@ freeNamesIfDecl (IfaceId _s t i) =
freeNamesIfDecl IfaceForeign{} = freeNamesIfDecl IfaceForeign{} =
emptyNameSet emptyNameSet
freeNamesIfDecl d@IfaceData{} = freeNamesIfDecl d@IfaceData{} =
freeNamesIfTvBndrs (ifTyVars d) &&&
freeNamesIfTcFam (ifFamInst d) &&& freeNamesIfTcFam (ifFamInst d) &&&
freeNamesIfContext (ifCtxt d) &&& freeNamesIfContext (ifCtxt d) &&&
freeNamesIfConDecls (ifCons d) freeNamesIfConDecls (ifCons d)
freeNamesIfDecl d@IfaceSyn{} = freeNamesIfDecl d@IfaceSyn{} =
freeNamesIfTvBndrs (ifTyVars d) &&&
freeNamesIfType (ifSynRhs d) &&& freeNamesIfType (ifSynRhs d) &&&
freeNamesIfTcFam (ifFamInst d) freeNamesIfTcFam (ifFamInst d)
freeNamesIfDecl d@IfaceClass{} = freeNamesIfDecl d@IfaceClass{} =
freeNamesIfTvBndrs (ifTyVars d) &&&
freeNamesIfContext (ifCtxt d) &&& freeNamesIfContext (ifCtxt d) &&&
freeNamesIfDecls (ifATs d) &&& freeNamesIfDecls (ifATs d) &&&
fnList freeNamesIfClsSig (ifSigs d) fnList freeNamesIfClsSig (ifSigs d)
...@@ -697,6 +700,8 @@ freeNamesIfConDecls _ = emptyNameSet ...@@ -697,6 +700,8 @@ freeNamesIfConDecls _ = emptyNameSet
freeNamesIfConDecl :: IfaceConDecl -> NameSet freeNamesIfConDecl :: IfaceConDecl -> NameSet
freeNamesIfConDecl c = freeNamesIfConDecl c =
freeNamesIfTvBndrs (ifConUnivTvs c) &&&
freeNamesIfTvBndrs (ifConExTvs c) &&&
freeNamesIfContext (ifConCtxt c) &&& freeNamesIfContext (ifConCtxt c) &&&
fnList freeNamesIfType (ifConArgTys c) &&& fnList freeNamesIfType (ifConArgTys c) &&&
fnList freeNamesIfType (map snd (ifConEqSpec c)) -- equality constraints fnList freeNamesIfType (map snd (ifConEqSpec c)) -- equality constraints
...@@ -715,9 +720,17 @@ freeNamesIfType (IfaceAppTy s t) = freeNamesIfType s &&& freeNamesIfType t ...@@ -715,9 +720,17 @@ freeNamesIfType (IfaceAppTy s t) = freeNamesIfType s &&& freeNamesIfType t
freeNamesIfType (IfacePredTy st) = freeNamesIfPredType st freeNamesIfType (IfacePredTy st) = freeNamesIfPredType st
freeNamesIfType (IfaceTyConApp tc ts) = freeNamesIfType (IfaceTyConApp tc ts) =
freeNamesIfTc tc &&& fnList freeNamesIfType ts freeNamesIfTc tc &&& fnList freeNamesIfType ts
freeNamesIfType (IfaceForAllTy _tv t) = freeNamesIfType t freeNamesIfType (IfaceForAllTy tv t) =
freeNamesIfTvBndr tv &&& freeNamesIfType t
freeNamesIfType (IfaceFunTy s t) = freeNamesIfType s &&& freeNamesIfType t freeNamesIfType (IfaceFunTy s t) = freeNamesIfType s &&& freeNamesIfType t
freeNamesIfTvBndrs :: [IfaceTvBndr] -> NameSet
freeNamesIfTvBndrs = fnList freeNamesIfTvBndr
freeNamesIfTvBndr :: IfaceTvBndr -> NameSet
freeNamesIfTvBndr (_fs,k) = freeNamesIfType k
-- kinds can have Names inside, when the Kind is an equality predicate
freeNamesIfIdInfo :: IfaceIdInfo -> NameSet freeNamesIfIdInfo :: IfaceIdInfo -> NameSet
freeNamesIfIdInfo NoInfo = emptyNameSet freeNamesIfIdInfo NoInfo = emptyNameSet
freeNamesIfIdInfo (HasInfo i) = fnList freeNamesItem i freeNamesIfIdInfo (HasInfo i) = fnList freeNamesItem i
......
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