[commit: ghc] ghc-8.2: Account for IfUnpackCo in freeNamesIfDecl (1e93425)
git at git.haskell.org
git at git.haskell.org
Tue May 23 23:47:33 UTC 2017
Repository : ssh://git@git.haskell.org/ghc
On branch : ghc-8.2
Link : http://ghc.haskell.org/trac/ghc/changeset/1e93425ee78481f10f79cb1d39b6cd4f11f38e5d/ghc
>---------------------------------------------------------------
commit 1e93425ee78481f10f79cb1d39b6cd4f11f38e5d
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date: Fri May 19 12:00:26 2017 +0100
Account for IfUnpackCo in freeNamesIfDecl
We were simply failing to recognise all the free variables of an
IfaceDecl, notably the ones in the coercion of an IfUnpackCo.
Result: the dependency analysis got messed up, so that fingerprint
calculation went wrong. Trac #13695 showed it up.
A test case is tricky but the fix is a solid one.
(cherry picked from commit 8fe37a0222517c3af5ffbb793fa738ad7f3eac3d)
>---------------------------------------------------------------
1e93425ee78481f10f79cb1d39b6cd4f11f38e5d
compiler/iface/IfaceSyn.hs | 21 +++++++++++++++------
1 file changed, 15 insertions(+), 6 deletions(-)
diff --git a/compiler/iface/IfaceSyn.hs b/compiler/iface/IfaceSyn.hs
index 5db8c99..6f8fcf4 100644
--- a/compiler/iface/IfaceSyn.hs
+++ b/compiler/iface/IfaceSyn.hs
@@ -1345,12 +1345,21 @@ freeNamesIfConDecls (IfNewTyCon c) = freeNamesIfConDecl c
freeNamesIfConDecls _ = emptyNameSet
freeNamesIfConDecl :: IfaceConDecl -> NameSet
-freeNamesIfConDecl c
- = freeNamesIfTyVarBndrs (ifConExTvs c) &&&
- freeNamesIfContext (ifConCtxt c) &&&
- fnList freeNamesIfType (ifConArgTys c) &&&
- mkNameSet (map flSelector (ifConFields c)) &&&
- fnList freeNamesIfType (map snd (ifConEqSpec c)) -- equality constraints
+freeNamesIfConDecl (IfCon { ifConExTvs = ex_tvs, ifConCtxt = ctxt
+ , ifConArgTys = arg_tys
+ , ifConFields = flds
+ , ifConEqSpec = eq_spec
+ , ifConStricts = bangs })
+ = freeNamesIfTyVarBndrs ex_tvs &&&
+ freeNamesIfContext ctxt &&&
+ fnList freeNamesIfType arg_tys &&&
+ mkNameSet (map flSelector flds) &&&
+ fnList freeNamesIfType (map snd eq_spec) &&& -- equality constraints
+ fnList freeNamesIfBang bangs
+
+freeNamesIfBang :: IfaceBang -> NameSet
+freeNamesIfBang (IfUnpackCo co) = freeNamesIfCoercion co
+freeNamesIfBang _ = emptyNameSet
freeNamesIfKind :: IfaceType -> NameSet
freeNamesIfKind = freeNamesIfType
More information about the ghc-commits
mailing list