[commit: ghc] master: Add regression test for #14246 (9ed7e8d)
git at git.haskell.org
git at git.haskell.org
Sat May 26 15:58:25 UTC 2018
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/9ed7e8d6a31b96ea2f171f1ad064294ee618b032/ghc
>---------------------------------------------------------------
commit 9ed7e8d6a31b96ea2f171f1ad064294ee618b032
Author: Ryan Scott <ryan.gl.scott at gmail.com>
Date: Sat May 26 11:58:03 2018 -0400
Add regression test for #14246
>---------------------------------------------------------------
9ed7e8d6a31b96ea2f171f1ad064294ee618b032
.../tests/indexed-types/should_fail/T14246.hs | 23 +++++++++++++++++++++
.../tests/indexed-types/should_fail/T14246.stderr | 24 ++++++++++++++++++++++
testsuite/tests/indexed-types/should_fail/all.T | 1 +
3 files changed, 48 insertions(+)
diff --git a/testsuite/tests/indexed-types/should_fail/T14246.hs b/testsuite/tests/indexed-types/should_fail/T14246.hs
new file mode 100644
index 0000000..cf947e8
--- /dev/null
+++ b/testsuite/tests/indexed-types/should_fail/T14246.hs
@@ -0,0 +1,23 @@
+{-# LANGUAGE RankNTypes, GADTs, TypeOperators, PolyKinds, DataKinds, TypeFamilies, AllowAmbiguousTypes, UndecidableInstances, TypeInType #-}
+
+module T14246 where
+
+import Data.Kind -- necessary for *
+
+data Nat = Z | S Nat
+
+data Vect :: Nat -> Type -> Type where
+ Nil :: Vect Z a
+ Cons :: a -> Vect n a -> Vect (S n) a
+
+data Label a = Label a
+
+data L
+
+type family KLN (n :: k) :: Nat where
+ KLN (f :: v -> k) = S (KLN (forall t. f t))
+ KLN (f :: *) = Z
+
+type family Reveal (n :: k) (l :: Vect (KLN n) L) :: * where
+ Reveal (f :: v -> k) (Cons (Label (t :: v)) l) = Reveal (f t) l
+ Reveal (a :: *) Nil = a
diff --git a/testsuite/tests/indexed-types/should_fail/T14246.stderr b/testsuite/tests/indexed-types/should_fail/T14246.stderr
new file mode 100644
index 0000000..0f0a3e5
--- /dev/null
+++ b/testsuite/tests/indexed-types/should_fail/T14246.stderr
@@ -0,0 +1,24 @@
+
+T14246.hs:18:5: error:
+ • Illegal polymorphic type: forall (t :: v). f t
+ • In the equations for closed type family ‘KLN’
+ In the type family declaration for ‘KLN’
+
+T14246.hs:22:27: error:
+ • Expected kind ‘Vect (KLN f) L’,
+ but ‘Cons (Label (t :: v)) l’ has kind ‘Vect ('S (KLN (f t))) *’
+ • In the second argument of ‘Reveal’, namely
+ ‘(Cons (Label (t :: v)) l)’
+ In the type family declaration for ‘Reveal’
+
+T14246.hs:22:67: error:
+ • Expected kind ‘Vect (KLN (f t)) L’,
+ but ‘l’ has kind ‘Vect (KLN (f t)) *’
+ • In the second argument of ‘Reveal’, namely ‘l’
+ In the type ‘Reveal (f t) l’
+ In the type family declaration for ‘Reveal’
+
+T14246.hs:23:21: error:
+ • Expected kind ‘Vect (KLN a) L’, but ‘Nil’ has kind ‘Vect 'Z L’
+ • In the second argument of ‘Reveal’, namely ‘Nil’
+ In the type family declaration for ‘Reveal’
diff --git a/testsuite/tests/indexed-types/should_fail/all.T b/testsuite/tests/indexed-types/should_fail/all.T
index 80ea5da..ef5eee2 100644
--- a/testsuite/tests/indexed-types/should_fail/all.T
+++ b/testsuite/tests/indexed-types/should_fail/all.T
@@ -141,5 +141,6 @@ test('T14033', normal, compile_fail, [''])
test('T14045a', normal, compile_fail, [''])
test('T14175', normal, compile_fail, [''])
test('T14179', normal, compile_fail, [''])
+test('T14246', normal, compile_fail, [''])
test('T14369', normal, compile_fail, [''])
test('T15172', normal, compile_fail, [''])
More information about the ghc-commits
mailing list