diff options
Diffstat (limited to 'testsuite/tests/polykinds')
-rw-r--r-- | testsuite/tests/polykinds/T16221.hs | 13 | ||||
-rw-r--r-- | testsuite/tests/polykinds/T16221a.hs | 7 | ||||
-rw-r--r-- | testsuite/tests/polykinds/T16221a.stderr | 6 | ||||
-rw-r--r-- | testsuite/tests/polykinds/T16342.hs | 13 | ||||
-rw-r--r-- | testsuite/tests/polykinds/all.T | 3 |
5 files changed, 42 insertions, 0 deletions
diff --git a/testsuite/tests/polykinds/T16221.hs b/testsuite/tests/polykinds/T16221.hs new file mode 100644 index 0000000000..56a83748da --- /dev/null +++ b/testsuite/tests/polykinds/T16221.hs @@ -0,0 +1,13 @@ +{-# LANGUAGE GADTs, TypeInType, ExistentialQuantification #-} + +module T16221 where + +-- Failed Lint +data T3 a = forall k (b :: k). MkT3 (T3 b) !Int + +-- Works with GADT +data T4 a where + MkT4 :: T4 b -> !Int -> T4 a + +-- Works with CUSK +data T5 (a :: j) = forall k (b :: k). MkT5 (T5 b) !Int diff --git a/testsuite/tests/polykinds/T16221a.hs b/testsuite/tests/polykinds/T16221a.hs new file mode 100644 index 0000000000..50128aa826 --- /dev/null +++ b/testsuite/tests/polykinds/T16221a.hs @@ -0,0 +1,7 @@ +{-# LANGUAGE TypeInType, ExistentialQuantification #-} + +module T16221a where + +data SameKind :: k -> k -> * +data T2 a = forall k (b :: k). MkT2 (SameKind a b) !Int + diff --git a/testsuite/tests/polykinds/T16221a.stderr b/testsuite/tests/polykinds/T16221a.stderr new file mode 100644 index 0000000000..27edc2c8ec --- /dev/null +++ b/testsuite/tests/polykinds/T16221a.stderr @@ -0,0 +1,6 @@ + +T16221a.hs:6:49: error: + • Expected kind ‘k1’, but ‘b’ has kind ‘k’ + • In the second argument of ‘SameKind’, namely ‘b’ + In the type ‘(SameKind a b)’ + In the definition of data constructor ‘MkT2’ diff --git a/testsuite/tests/polykinds/T16342.hs b/testsuite/tests/polykinds/T16342.hs new file mode 100644 index 0000000000..5eafcee9ec --- /dev/null +++ b/testsuite/tests/polykinds/T16342.hs @@ -0,0 +1,13 @@ +{-# LANGUAGE MultiParamTypeClasses, TypeInType, ConstrainedClassMethods, ScopedTypeVariables #-} + +module T16342 where + +import Data.Proxy + +class C (a::ka) x where + cop :: D a x => x -> Proxy a -> Proxy a + cop _ x = x :: Proxy (a::ka) + +class D (b::kb) y where + dop :: C b y => y -> Proxy b -> Proxy b + dop _ x = x :: Proxy (b::kb) diff --git a/testsuite/tests/polykinds/all.T b/testsuite/tests/polykinds/all.T index 1cfb2aa424..927319c1a7 100644 --- a/testsuite/tests/polykinds/all.T +++ b/testsuite/tests/polykinds/all.T @@ -207,3 +207,6 @@ test('T14847', normal, compile, ['']) test('T15795', normal, compile, ['']) test('T15795a', normal, compile, ['']) test('KindVarOrder', normal, ghci_script, ['KindVarOrder.script']) +test('T16221', normal, compile, ['']) +test('T16221a', normal, compile_fail, ['']) +test('T16342', normal, compile, ['']) |