[commit: ghc] master: Kind variables in RHS of an associated type instances should be bound on LHS (171101b)
git at git.haskell.org
git at git.haskell.org
Fri Nov 28 17:37:25 UTC 2014
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/171101beca39befde191baff5027c417bcc709ee/ghc
>---------------------------------------------------------------
commit 171101beca39befde191baff5027c417bcc709ee
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date: Fri Nov 28 17:23:08 2014 +0000
Kind variables in RHS of an associated type instances should be bound on LHS
This patche fixes Trac #9574.
The previous Note [Renaming associated types] in RnTypes appears to me to be wrong;
it confused class and instance declarations.
I have:
* Treated kind and type variables uniformly. Both must be bound on the LHS
of an associated type instance. Eg
instance C ('KProxy :: KProxy o) where
type F 'KProxy = NatTr (Proxy :: o -> *)
is illegal because 'o' is not bound on the LHS of the instance.
* Moved the Note to RnSource and fixed it up
This improves the error message from T7938. However it made the code in
T6118 incorrect. We had:
instance SingE (a :: Maybe k) where
type Demote a = Maybe (Demote (Any :: k))
and that is now rejected, rightly I think.
>---------------------------------------------------------------
171101beca39befde191baff5027c417bcc709ee
compiler/rename/RnSource.lhs | 53 +++++++++++++++++-----
compiler/rename/RnTypes.lhs | 25 ----------
compiler/typecheck/TcInstDcls.lhs | 14 +-----
.../tests/indexed-types/should_fail/T5515.stderr | 4 +-
.../tests/indexed-types/should_fail/T7938.stderr | 8 ++--
testsuite/tests/polykinds/T6118.hs | 2 +-
testsuite/tests/polykinds/T9574.hs | 18 ++++++++
testsuite/tests/polykinds/T9574.stderr | 4 ++
testsuite/tests/polykinds/all.T | 1 +
9 files changed, 72 insertions(+), 57 deletions(-)
Diff suppressed because of size. To see it, use:
git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 171101beca39befde191baff5027c417bcc709ee
More information about the ghc-commits
mailing list