summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/tests/polykinds/T18300.hs16
-rw-r--r--testsuite/tests/polykinds/T18300.stderr4
-rw-r--r--testsuite/tests/polykinds/all.T1
-rw-r--r--testsuite/tests/typecheck/should_compile/all.T2
-rw-r--r--testsuite/tests/typecheck/should_fail/T18357.hs13
-rw-r--r--testsuite/tests/typecheck/should_fail/T18357.stderr6
-rw-r--r--testsuite/tests/typecheck/should_fail/T18357a.hs10
-rw-r--r--testsuite/tests/typecheck/should_fail/T18357a.stderr7
-rw-r--r--testsuite/tests/typecheck/should_fail/T18357b.hs13
-rw-r--r--testsuite/tests/typecheck/should_fail/T18357b.stderr6
-rw-r--r--testsuite/tests/typecheck/should_fail/all.T3
11 files changed, 80 insertions, 1 deletions
diff --git a/testsuite/tests/polykinds/T18300.hs b/testsuite/tests/polykinds/T18300.hs
new file mode 100644
index 0000000000..e0052dc498
--- /dev/null
+++ b/testsuite/tests/polykinds/T18300.hs
@@ -0,0 +1,16 @@
+{-# LANGUAGE GADTs, PolyKinds, DataKinds, TypeFamilies #-}
+
+module Foo where
+
+import GHC.Exts
+import Data.Kind
+
+type family F a :: RuntimeRep
+type instance F Int = 'LiftedRep
+
+data family T a :: TYPE (F a)
+
+data instance T Int where
+ MkT :: Int -> T Int
+
+-- ASSERT error in HEAD
diff --git a/testsuite/tests/polykinds/T18300.stderr b/testsuite/tests/polykinds/T18300.stderr
new file mode 100644
index 0000000000..53ea72b1b8
--- /dev/null
+++ b/testsuite/tests/polykinds/T18300.stderr
@@ -0,0 +1,4 @@
+
+T18300.hs:13:1: error:
+ • Data instance has non-* return kind ‘TYPE (F Int)’
+ • In the data instance declaration for ‘T’
diff --git a/testsuite/tests/polykinds/all.T b/testsuite/tests/polykinds/all.T
index 592c6b2fec..00856b8dc3 100644
--- a/testsuite/tests/polykinds/all.T
+++ b/testsuite/tests/polykinds/all.T
@@ -219,3 +219,4 @@ test('T16902', normal, compile_fail, [''])
test('CuskFam', normal, compile, [''])
test('T17841', normal, compile_fail, [''])
test('T17963', normal, compile_fail, [''])
+test('T18300', normal, compile_fail, [''])
diff --git a/testsuite/tests/typecheck/should_compile/all.T b/testsuite/tests/typecheck/should_compile/all.T
index 8d7c1f573f..1ace8dbc15 100644
--- a/testsuite/tests/typecheck/should_compile/all.T
+++ b/testsuite/tests/typecheck/should_compile/all.T
@@ -685,7 +685,7 @@ test('UnliftedNewtypesUnifySig', normal, compile, [''])
test('UnliftedNewtypesForall', normal, compile, [''])
test('UnlifNewUnify', normal, compile, [''])
test('UnliftedNewtypesLPFamily', normal, compile, [''])
-test('UnliftedNewtypesDifficultUnification', when(compiler_debugged(), expect_broken(18300)), compile, [''])
+test('UnliftedNewtypesDifficultUnification', normal, compile, [''])
test('T16832', normal, ghci_script, ['T16832.script'])
test('T16995', normal, compile, [''])
test('T17007', normal, compile, [''])
diff --git a/testsuite/tests/typecheck/should_fail/T18357.hs b/testsuite/tests/typecheck/should_fail/T18357.hs
new file mode 100644
index 0000000000..afa566ba33
--- /dev/null
+++ b/testsuite/tests/typecheck/should_fail/T18357.hs
@@ -0,0 +1,13 @@
+{-# LANGUAGE StandaloneKindSignatures, TypeFamilies, GADTs, DataKinds #-}
+
+module T18357 where
+
+import Data.Kind
+
+type family Star where Star = Type
+
+type W :: Star
+type W = T
+
+newtype T where
+ MkT :: Int -> W
diff --git a/testsuite/tests/typecheck/should_fail/T18357.stderr b/testsuite/tests/typecheck/should_fail/T18357.stderr
new file mode 100644
index 0000000000..60762c4dcb
--- /dev/null
+++ b/testsuite/tests/typecheck/should_fail/T18357.stderr
@@ -0,0 +1,6 @@
+
+T18357.hs:13:3: error:
+ • Data constructor ‘MkT’ returns type ‘W’
+ instead of an instance of its parent type ‘T’
+ • In the definition of data constructor ‘MkT’
+ In the newtype declaration for ‘T’
diff --git a/testsuite/tests/typecheck/should_fail/T18357a.hs b/testsuite/tests/typecheck/should_fail/T18357a.hs
new file mode 100644
index 0000000000..52fc4defe9
--- /dev/null
+++ b/testsuite/tests/typecheck/should_fail/T18357a.hs
@@ -0,0 +1,10 @@
+{-# LANGUAGE PolyKinds, UnliftedNewtypes, StandaloneKindSignatures, TypeFamilies, GADTs, DataKinds #-}
+
+module T18357a where
+
+import Data.Kind
+import GHC.Exts
+
+newtype T :: TYPE r where
+ MkT :: Int -> T
+
diff --git a/testsuite/tests/typecheck/should_fail/T18357a.stderr b/testsuite/tests/typecheck/should_fail/T18357a.stderr
new file mode 100644
index 0000000000..a9e87fed98
--- /dev/null
+++ b/testsuite/tests/typecheck/should_fail/T18357a.stderr
@@ -0,0 +1,7 @@
+
+T18357a.hs:9:10: error:
+ • Couldn't match kind ‘r’ with ‘'LiftedRep’
+ Expected a type, but ‘Int’ has kind ‘*’
+ • In the type ‘Int’
+ In the definition of data constructor ‘MkT’
+ In the newtype declaration for ‘T’
diff --git a/testsuite/tests/typecheck/should_fail/T18357b.hs b/testsuite/tests/typecheck/should_fail/T18357b.hs
new file mode 100644
index 0000000000..24c68f037c
--- /dev/null
+++ b/testsuite/tests/typecheck/should_fail/T18357b.hs
@@ -0,0 +1,13 @@
+{-# LANGUAGE UnliftedNewtypes, StandaloneKindSignatures, TypeFamilies, GADTs, DataKinds #-}
+
+module T18357b where
+
+import Data.Kind
+
+type family Star where Star = Type
+
+newtype T :: Type where
+ MkT :: Int -> (T :: Star)
+
+-- The error message is pretty terrible
+-- but it probably nevery happens in practice
diff --git a/testsuite/tests/typecheck/should_fail/T18357b.stderr b/testsuite/tests/typecheck/should_fail/T18357b.stderr
new file mode 100644
index 0000000000..c758e81543
--- /dev/null
+++ b/testsuite/tests/typecheck/should_fail/T18357b.stderr
@@ -0,0 +1,6 @@
+
+T18357b.hs:10:3: error:
+ • Data constructor ‘MkT’ returns type ‘T’
+ instead of an instance of its parent type ‘T’
+ • In the definition of data constructor ‘MkT’
+ In the newtype declaration for ‘T’
diff --git a/testsuite/tests/typecheck/should_fail/all.T b/testsuite/tests/typecheck/should_fail/all.T
index 0b4e6b70d7..c9b785554e 100644
--- a/testsuite/tests/typecheck/should_fail/all.T
+++ b/testsuite/tests/typecheck/should_fail/all.T
@@ -575,3 +575,6 @@ test('ExplicitSpecificity7', normal, compile_fail, [''])
test('ExplicitSpecificity8', normal, compile_fail, [''])
test('ExplicitSpecificity9', normal, compile_fail, [''])
test('ExplicitSpecificity10', normal, compile_fail, [''])
+test('T18357', normal, compile_fail, [''])
+test('T18357a', normal, compile_fail, [''])
+test('T18357b', normal, compile_fail, [''])