Commit efaa51de authored by Jan Stolarek's avatar Jan Stolarek
Browse files

Look through type synonyms in GADT kind signatures

Summary: Fixes #11237

Test Plan: ./validate

Reviewers: goldfire, austin, bgamari

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D1636

GHC Trac Issues: #11237
parent 11b9ada1
......@@ -114,7 +114,7 @@ module TyCoRep (
import {-# SOURCE #-} DataCon( dataConTyCon, dataConFullSig
, DataCon, eqSpecTyVar )
import {-# SOURCE #-} Type( isPredTy, isCoercionTy, mkAppTy
, partitionInvisibles )
, partitionInvisibles, coreView )
-- Transitively pulls in a LOT of stuff, better to break the loop
import {-# SOURCE #-} Coercion
......@@ -412,13 +412,13 @@ Some basic functions, put here to break loops eg with the pretty printer
-}
isLiftedTypeKind :: Kind -> Bool
isLiftedTypeKind (TyConApp tc []) = isLiftedTypeKindTyConName (tyConName tc)
isLiftedTypeKind ki | Just ki' <- coreView ki = isLiftedTypeKind ki'
isLiftedTypeKind (TyConApp tc [TyConApp lev []])
= tc `hasKey` tYPETyConKey && lev `hasKey` liftedDataConKey
isLiftedTypeKind _ = False
isUnliftedTypeKind :: Kind -> Bool
isUnliftedTypeKind (TyConApp tc []) = tc `hasKey` unliftedTypeKindTyConKey
isUnliftedTypeKind ki | Just ki' <- coreView ki = isUnliftedTypeKind ki'
isUnliftedTypeKind (TyConApp tc [TyConApp lev []])
= tc `hasKey` tYPETyConKey && lev `hasKey` unliftedDataConKey
isUnliftedTypeKind _ = False
......
......@@ -14,3 +14,5 @@ eqType :: Type -> Type -> Bool
coreViewOneStarKind :: Type -> Maybe Type
partitionInvisibles :: TyCon -> (a -> Type) -> [a] -> ([a], [a])
coreView :: Type -> Maybe Type
{-# LANGUAGE TypeInType #-}
{-# LANGUAGE GADTs #-}
module TypeInTypeBug where
import qualified Data.Kind
data Works :: Data.Kind.Type where
WorksConstr :: Works
type Set = Data.Kind.Type
data ShouldWork :: Set where
ShouldWorkConstr :: ShouldWork
......@@ -479,3 +479,4 @@ test('T10770a', expect_broken(10770), compile, [''])
test('T10770b', expect_broken(10770), compile, [''])
test('T10935', normal, compile, [''])
test('T10971a', normal, compile, [''])
test('T11237', normal, compile, [''])
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment