diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2020-12-21 17:47:26 +0000 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2020-12-24 06:41:07 -0500 |
commit | e7d8e4eec179634b34c284c3fdb0bfd1b85f9928 (patch) | |
tree | 3a813f1ea5bce426d0c778b02e3eea1976d741fa /compiler/GHC/Core | |
parent | 79d41f93a98d1a331f7c2dfee55da9c1fea01380 (diff) | |
download | haskell-e7d8e4eec179634b34c284c3fdb0bfd1b85f9928.tar.gz |
Clone the binders of a SAKS where necessary
Given a kind signature
type T :: forall k. k -> forall k. k -> blah
data T a b = ...
where those k's have the same unique (which is possible;
see #19093) we were giving the tyConBinders in tycon T the same
unique, which caused chaos.
Fix is simple: ensure uniqueness when decomposing the kind signature.
See GHC.Tc.Gen.HsType.zipBinders
Diffstat (limited to 'compiler/GHC/Core')
-rw-r--r-- | compiler/GHC/Core/TyCo/Subst.hs | 8 | ||||
-rw-r--r-- | compiler/GHC/Core/Type.hs | 1 |
2 files changed, 9 insertions, 0 deletions
diff --git a/compiler/GHC/Core/TyCo/Subst.hs b/compiler/GHC/Core/TyCo/Subst.hs index bc6632f1bf..7ea61bdae2 100644 --- a/compiler/GHC/Core/TyCo/Subst.hs +++ b/compiler/GHC/Core/TyCo/Subst.hs @@ -46,6 +46,7 @@ module GHC.Core.TyCo.Subst substTyVarBndr, substTyVarBndrs, substCoVarBndr, substTyVar, substTyVars, substTyCoVars, + substTyCoBndr, substForAllCoBndr, substVarBndrUsing, substForAllCoBndrUsing, checkValidSubst, isValidTCvSubst, @@ -1054,3 +1055,10 @@ cloneTyVarBndrs subst (t:ts) usupply = (subst'', tv:tvs) (uniq, usupply') = takeUniqFromSupply usupply (subst' , tv ) = cloneTyVarBndr subst t uniq (subst'', tvs) = cloneTyVarBndrs subst' ts usupply' + +substTyCoBndr :: TCvSubst -> TyCoBinder -> (TCvSubst, TyCoBinder) +substTyCoBndr subst (Anon af ty) = (subst, Anon af (substScaledTy subst ty)) +substTyCoBndr subst (Named (Bndr tv vis)) = (subst', Named (Bndr tv' vis)) + where + (subst', tv') = substVarBndr subst tv + diff --git a/compiler/GHC/Core/Type.hs b/compiler/GHC/Core/Type.hs index e5d0da93fd..af92b92e52 100644 --- a/compiler/GHC/Core/Type.hs +++ b/compiler/GHC/Core/Type.hs @@ -212,6 +212,7 @@ module GHC.Core.Type ( substCoUnchecked, substCoWithUnchecked, substTyVarBndr, substTyVarBndrs, substTyVar, substTyVars, substVarBndr, substVarBndrs, + substTyCoBndr, cloneTyVarBndr, cloneTyVarBndrs, lookupTyVar, -- * Tidying type related things up for printing |