diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2020-01-23 09:40:33 +0000 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2020-02-01 02:28:45 -0500 |
commit | 913287a0fa5370a2488ce560f2dfba61db51055d (patch) | |
tree | 6506f059b45bd05b29b45095c3a3cbdb49f2f609 /testsuite/tests/typecheck/should_fail/T17566b.stderr | |
parent | cd11042337a829da1dfbd19ca1a46feabdd23147 (diff) | |
download | haskell-913287a0fa5370a2488ce560f2dfba61db51055d.tar.gz |
Fix scoping of TyCon binders in TcTyClsDecls
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 'testsuite/tests/typecheck/should_fail/T17566b.stderr')
-rw-r--r-- | testsuite/tests/typecheck/should_fail/T17566b.stderr | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/testsuite/tests/typecheck/should_fail/T17566b.stderr b/testsuite/tests/typecheck/should_fail/T17566b.stderr new file mode 100644 index 0000000000..be3c0e19bd --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T17566b.stderr @@ -0,0 +1,4 @@ + +T17566b.hs:7:17: error: + • Different names for the same type variable: ‘k1’ and ‘k2’ + • In the class declaration for ‘C’ |