summaryrefslogtreecommitdiff
path: root/testsuite/tests
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/tests')
-rw-r--r--testsuite/tests/dependent/should_compile/T12442.hs3
-rw-r--r--testsuite/tests/dependent/should_compile/T16326_Compile1.hs4
-rw-r--r--testsuite/tests/dependent/should_compile/T16344b.hs10
-rw-r--r--testsuite/tests/dependent/should_compile/all.T2
-rw-r--r--testsuite/tests/dependent/should_fail/T16344.hs8
-rw-r--r--testsuite/tests/dependent/should_fail/T16344.stderr6
-rw-r--r--testsuite/tests/dependent/should_fail/T16344a.hs11
-rw-r--r--testsuite/tests/dependent/should_fail/T16344a.stderr6
-rw-r--r--testsuite/tests/dependent/should_fail/all.T2
-rw-r--r--testsuite/tests/parser/should_compile/DumpRenamedAst.stderr32
-rw-r--r--testsuite/tests/parser/should_compile/T14189.stderr15
-rw-r--r--testsuite/tests/typecheck/should_fail/T12785b.hs4
12 files changed, 65 insertions, 38 deletions
diff --git a/testsuite/tests/dependent/should_compile/T12442.hs b/testsuite/tests/dependent/should_compile/T12442.hs
index c76dfb962e..b4bcdb9d62 100644
--- a/testsuite/tests/dependent/should_compile/T12442.hs
+++ b/testsuite/tests/dependent/should_compile/T12442.hs
@@ -33,7 +33,8 @@ data EffElem :: (Type ~> Type ~> Type ~> Type) -> Type -> [EFFECT] -> Type where
data instance Sing (elem :: EffElem x a xs) where
SHere :: Sing Here
-type family UpdateResTy b t (xs :: [EFFECT]) (elem :: EffElem e a xs)
+type family UpdateResTy (b :: Type) (t :: Type)
+ (xs :: [EFFECT]) (elem :: EffElem e a xs)
(thing :: e @@ a @@ b @@ t) :: [EFFECT] where
UpdateResTy b _ (MkEff a e ': xs) Here n = MkEff b e ': xs
diff --git a/testsuite/tests/dependent/should_compile/T16326_Compile1.hs b/testsuite/tests/dependent/should_compile/T16326_Compile1.hs
index 109b18e9f7..789798b370 100644
--- a/testsuite/tests/dependent/should_compile/T16326_Compile1.hs
+++ b/testsuite/tests/dependent/should_compile/T16326_Compile1.hs
@@ -20,7 +20,9 @@ type DComp a
(x :: a) =
f (g x)
-type family ElimList a
+-- Ensure that ElimList has a CUSK, beuas it is
+-- is used polymorphically its RHS (c.f. Trac #16344)
+type family ElimList (a :: Type)
(p :: [a] -> Type)
(s :: [a])
(pNil :: p '[])
diff --git a/testsuite/tests/dependent/should_compile/T16344b.hs b/testsuite/tests/dependent/should_compile/T16344b.hs
new file mode 100644
index 0000000000..1f6fa8a00e
--- /dev/null
+++ b/testsuite/tests/dependent/should_compile/T16344b.hs
@@ -0,0 +1,10 @@
+{-# LANGUAGE TypeInType, GADTs, KindSignatures #-}
+
+module T16344 where
+
+import Data.Kind
+
+-- This one is accepted, even though it is polymorphic-recursive.
+-- See Note [No polymorphic recursion] in TcHsType
+
+data T3 ka (a::ka) = forall b. MkT3 (T3 Type b)
diff --git a/testsuite/tests/dependent/should_compile/all.T b/testsuite/tests/dependent/should_compile/all.T
index 4ba649ac9d..4e162aed69 100644
--- a/testsuite/tests/dependent/should_compile/all.T
+++ b/testsuite/tests/dependent/should_compile/all.T
@@ -68,3 +68,5 @@ test('T14729kind', normal, ghci_script, ['T14729kind.script'])
test('T16326_Compile1', normal, compile, [''])
test('T16326_Compile2', normal, compile, [''])
test('T16391a', normal, compile, [''])
+test('T16344b', normal, compile, [''])
+
diff --git a/testsuite/tests/dependent/should_fail/T16344.hs b/testsuite/tests/dependent/should_fail/T16344.hs
new file mode 100644
index 0000000000..0cf4b98642
--- /dev/null
+++ b/testsuite/tests/dependent/should_fail/T16344.hs
@@ -0,0 +1,8 @@
+{-# LANGUAGE TypeInType, KindSignatures #-}
+
+module T16344 where
+
+import Data.Kind
+
+data T ka (a::ka) b = MkT (T Type Int Bool)
+ (T (Type -> Type) Maybe Bool)
diff --git a/testsuite/tests/dependent/should_fail/T16344.stderr b/testsuite/tests/dependent/should_fail/T16344.stderr
new file mode 100644
index 0000000000..b47561771f
--- /dev/null
+++ b/testsuite/tests/dependent/should_fail/T16344.stderr
@@ -0,0 +1,6 @@
+
+T16344.hs:7:46: error:
+ • Expected kind ‘ka’, but ‘Int’ has kind ‘*’
+ • In the second argument of ‘T’, namely ‘Int’
+ In the type ‘(T Type Int Bool)’
+ In the definition of data constructor ‘MkT’
diff --git a/testsuite/tests/dependent/should_fail/T16344a.hs b/testsuite/tests/dependent/should_fail/T16344a.hs
new file mode 100644
index 0000000000..cb4d1a7f21
--- /dev/null
+++ b/testsuite/tests/dependent/should_fail/T16344a.hs
@@ -0,0 +1,11 @@
+{-# LANGUAGE TypeInType, KindSignatures #-}
+
+module T16344 where
+
+import Data.Kind
+
+-- This one is rejected, but in the typechecking phase
+-- which is a bit nasty.
+-- See Note [No polymorphic recursion] in TcHsType
+
+data T2 ka (a::ka) = MkT2 (T2 Type a)
diff --git a/testsuite/tests/dependent/should_fail/T16344a.stderr b/testsuite/tests/dependent/should_fail/T16344a.stderr
new file mode 100644
index 0000000000..d838d14e57
--- /dev/null
+++ b/testsuite/tests/dependent/should_fail/T16344a.stderr
@@ -0,0 +1,6 @@
+
+T16344a.hs:11:36: error:
+ • Expected a type, but ‘a’ has kind ‘ka’
+ • In the second argument of ‘T2’, namely ‘a’
+ In the type ‘(T2 Type a)’
+ In the definition of data constructor ‘MkT2’
diff --git a/testsuite/tests/dependent/should_fail/all.T b/testsuite/tests/dependent/should_fail/all.T
index baaddd7442..1f75a85716 100644
--- a/testsuite/tests/dependent/should_fail/all.T
+++ b/testsuite/tests/dependent/should_fail/all.T
@@ -53,3 +53,5 @@ test('T16326_Fail10', normal, compile_fail, [''])
test('T16326_Fail11', normal, compile_fail, [''])
test('T16326_Fail12', normal, compile_fail, [''])
test('T16391b', normal, compile_fail, ['-fprint-explicit-runtime-reps'])
+test('T16344', normal, compile_fail, [''])
+test('T16344a', normal, compile_fail, [''])
diff --git a/testsuite/tests/parser/should_compile/DumpRenamedAst.stderr b/testsuite/tests/parser/should_compile/DumpRenamedAst.stderr
index 1bc285ac3b..8dd85edcd6 100644
--- a/testsuite/tests/parser/should_compile/DumpRenamedAst.stderr
+++ b/testsuite/tests/parser/should_compile/DumpRenamedAst.stderr
@@ -68,10 +68,7 @@
({ DumpRenamedAst.hs:9:6-10 }
{Name: DumpRenamedAst.Peano})
(HsQTvs
- (HsQTvsRn
- []
- {NameSet:
- []})
+ []
[])
(Prefix)
(HsDataDefn
@@ -205,10 +202,7 @@
({ DumpRenamedAst.hs:11:13-18 }
{Name: DumpRenamedAst.Length})
(HsQTvs
- (HsQTvsRn
- [{Name: k}]
- {NameSet:
- []})
+ [{Name: k}]
[({ DumpRenamedAst.hs:11:21-29 }
(KindedTyVar
(NoExt)
@@ -247,10 +241,7 @@
({ DumpRenamedAst.hs:15:13-15 }
{Name: DumpRenamedAst.Nat})
(HsQTvs
- (HsQTvsRn
- [{Name: k}]
- {NameSet:
- []})
+ [{Name: k}]
[])
(Prefix)
({ DumpRenamedAst.hs:15:17-33 }
@@ -365,11 +356,8 @@
({ DumpRenamedAst.hs:19:10-45 }
(False))
(HsQTvs
- (HsQTvsRn
- [{Name: f}
- ,{Name: g}]
- {NameSet:
- []})
+ [{Name: f}
+ ,{Name: g}]
[])
(Nothing)
(PrefixCon
@@ -457,10 +445,7 @@
({ DumpRenamedAst.hs:21:6 }
{Name: DumpRenamedAst.T})
(HsQTvs
- (HsQTvsRn
- [{Name: k}]
- {NameSet:
- []})
+ [{Name: k}]
[({ DumpRenamedAst.hs:21:8 }
(UserTyVar
(NoExt)
@@ -595,10 +580,7 @@
({ DumpRenamedAst.hs:23:13-14 }
{Name: DumpRenamedAst.F1})
(HsQTvs
- (HsQTvsRn
- [{Name: k}]
- {NameSet:
- []})
+ [{Name: k}]
[({ DumpRenamedAst.hs:23:17-22 }
(KindedTyVar
(NoExt)
diff --git a/testsuite/tests/parser/should_compile/T14189.stderr b/testsuite/tests/parser/should_compile/T14189.stderr
index e5aff5bf88..dd8df9dc04 100644
--- a/testsuite/tests/parser/should_compile/T14189.stderr
+++ b/testsuite/tests/parser/should_compile/T14189.stderr
@@ -7,25 +7,22 @@
(NoExt)
(XValBindsLR
(NValBinds
- []
- []))
+ []
+ []))
[]
[(TyClGroup
(NoExt)
[({ T14189.hs:6:1-42 }
(DataDecl
(DataDeclRn
- (True)
- {NameSet:
- [{Name: GHC.Types.Int}]})
+ (True)
+ {NameSet:
+ [{Name: GHC.Types.Int}]})
({ T14189.hs:6:6-11 }
{Name: T14189.MyType})
(HsQTvs
- (HsQTvsRn
[]
- {NameSet:
- []})
- [])
+ [])
(Prefix)
(HsDataDefn
(NoExt)
diff --git a/testsuite/tests/typecheck/should_fail/T12785b.hs b/testsuite/tests/typecheck/should_fail/T12785b.hs
index b827372bf0..951b04c6cd 100644
--- a/testsuite/tests/typecheck/should_fail/T12785b.hs
+++ b/testsuite/tests/typecheck/should_fail/T12785b.hs
@@ -13,7 +13,7 @@ data HTree n a where
Leaf :: HTree (S n) a
Branch :: a -> HTree n (HTree (S n) a) -> HTree (S n) a
-data STree n :: forall a . (a -> Type) -> HTree n a -> Type where
+data STree (n ::Peano) :: forall a . (a -> Type) -> HTree n a -> Type where
SPoint :: f a -> STree Z f (Point a)
SLeaf :: STree (S n) f Leaf
SBranch :: f a -> STree n (STree (S n) f) stru -> STree (S n) f (a `Branch` stru)
@@ -33,6 +33,6 @@ hmap f (Point a) = Point (f a)
hmap f Leaf = Leaf
hmap f (a `Branch` tr) = f a `Branch` hmap (hmap f) tr
-type family Payload (n :: Peano) (s :: HTree n x) where
+type family Payload (n :: Peano) (s :: HTree n x) :: x where
Payload Z (Point a) = a
Payload (S n) (a `Branch` stru) = a