diff options
author | Ryan Scott <ryan.gl.scott@gmail.com> | 2018-09-02 22:03:53 +0200 |
---|---|---|
committer | Krzysztof Gogolewski <krz.gogolewski@gmail.com> | 2018-09-02 22:03:53 +0200 |
commit | 6dea7c161e458ddb3ea4afd366887c8d963c6585 (patch) | |
tree | 6bfdf85a9c641cdbb94850a0049c288fb2d22232 /compiler/types/Type.hs | |
parent | 565ef4cc036905f9f9801c1e775236bb007b026c (diff) | |
download | haskell-6dea7c161e458ddb3ea4afd366887c8d963c6585.tar.gz |
Reject class instances with type families in kinds
Summary:
GHC doesn't know how to handle type families that appear in
class instances. Unfortunately, GHC didn't reject instances where
type families appear in //kinds//, leading to #15515. This is easily
rectified by calling `checkValidTypePat` on all arguments to a class
in an instance (and not just the type arguments).
Test Plan: make test TEST=T15515
Reviewers: bgamari, goldfire, simonpj
Reviewed By: simonpj
Subscribers: simonpj, rwbarton, carter
GHC Trac Issues: #15515
Differential Revision: https://phabricator.haskell.org/D5068
Diffstat (limited to 'compiler/types/Type.hs')
-rw-r--r-- | compiler/types/Type.hs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/compiler/types/Type.hs b/compiler/types/Type.hs index 2529bfb89d..180af3862c 100644 --- a/compiler/types/Type.hs +++ b/compiler/types/Type.hs @@ -60,7 +60,7 @@ module Type ( stripCoercionTy, splitCoercionType_maybe, splitPiTysInvisible, filterOutInvisibleTypes, - partitionInvisibles, + partitionInvisibleTypes, partitionInvisibles, synTyConResKind, modifyJoinResTy, setJoinResTy, @@ -1450,7 +1450,12 @@ splitPiTysInvisible ty = split ty ty [] -- | Given a tycon and its arguments, filters out any invisible arguments filterOutInvisibleTypes :: TyCon -> [Type] -> [Type] -filterOutInvisibleTypes tc tys = snd $ partitionInvisibles tc id tys +filterOutInvisibleTypes tc tys = snd $ partitionInvisibleTypes tc tys + +-- | Given a 'TyCon' and its arguments, partition the arguments into +-- (invisible arguments, visible arguments). +partitionInvisibleTypes :: TyCon -> [Type] -> ([Type], [Type]) +partitionInvisibleTypes tc tys = partitionInvisibles tc id tys -- | Given a tycon and a list of things (which correspond to arguments), -- partitions the things into |