diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2020-01-23 09:40:33 +0000 |
---|---|---|
committer | Ryan Scott <ryan.gl.scott@gmail.com> | 2020-01-31 05:59:34 -0500 |
commit | b9605396f1f1560aea94792646b835cadcb49f45 (patch) | |
tree | 5a006eb0caa03aca094cd6b002bb000e23881c14 /compiler/deSugar/ExtractDocs.hs | |
parent | fa37940cd72f82abc460f5c0a5de64dd75cee6ae (diff) | |
download | haskell-wip/T17566.tar.gz |
Fix scoping of TyCon binders in TcTyClsDeclswip/T17566
This patch fixes #17566 by refactoring the way we decide the final
identity of the tyvars in the TyCons of a possibly-recursive nest
of type and class decls, possibly with associated types.
It's all laid out in
Note [Swizzling the tyvars before generaliseTcTyCon]
Main changes:
* We have to generalise each decl (with its associated types)
all at once: TcTyClsDecls.generaliseTyClDecl
* The main new work is done in TcTyClsDecls.swizzleTcTyConBndrs
* The mysterious TcHsSyn.zonkRecTyVarBndrs dies altogether
Other smaller things:
* A little refactoring, moving bindTyClTyVars from tcTyClDecl1
to tcDataDefn, tcSynRhs, etc. Clearer, reduces the number of
parameters
* Reduce the amount of swizzling required.
Specifically, bindExplicitTKBndrs_Q_Tv doesn't need
to clone a new Name for the TyVarTv, and not
cloning means that in the vasly common case,
swizzleTyConBndrs is a no-op
In detail:
Rename newTyVarTyVar --> cloneTyVarTyVar
Add newTyVarTyTyVar that doesn't clone
Use the non-cloning newTyVarTyVar in
bindExplicitTKBndrs_Q_Tv
Rename newFlexiKindedTyVarTyVar
--> cloneFlexiKindedTyVarTyVar
* Define new utility function and use it
HsDecls.familyDeclName ::
FamilyDecl (GhcPass p) -> IdP (GhcPass p)
Updates haddock submodule.
Diffstat (limited to 'compiler/deSugar/ExtractDocs.hs')
-rw-r--r-- | compiler/deSugar/ExtractDocs.hs | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/compiler/deSugar/ExtractDocs.hs b/compiler/deSugar/ExtractDocs.hs index 8612a05cb9..632207c41f 100644 --- a/compiler/deSugar/ExtractDocs.hs +++ b/compiler/deSugar/ExtractDocs.hs @@ -14,7 +14,6 @@ import GHC.Hs.Binds import GHC.Hs.Doc import GHC.Hs.Decls import GHC.Hs.Extension -import GHC.Hs.Pat import GHC.Hs.Types import GHC.Hs.Utils import Name @@ -117,8 +116,7 @@ user-written. This lets us relate Names (from ClsInsts) to comments (associated with InstDecls and DerivDecls). -} -getMainDeclBinder :: XRec pass Pat ~ Located (Pat pass) => - HsDecl pass -> [IdP pass] +getMainDeclBinder :: HsDecl (GhcPass p) -> [IdP (GhcPass p)] getMainDeclBinder (TyClD _ d) = [tcdName d] getMainDeclBinder (ValD _ d) = case collectHsBindBinders d of |