Add regression tests for #14904
authorRyan Scott <ryan.gl.scott@gmail.com>
Thu, 3 May 2018 14:15:45 +0000 (10:15 -0400)
committerRyan Scott <ryan.gl.scott@gmail.com>
Thu, 3 May 2018 14:15:50 +0000 (10:15 -0400)
Trac #14904 was fixed in commit
faec8d358985e5d0bf363bd96f23fe76c9e281f7. Let's add some tests to
ensure that it stays fixed.

testsuite/tests/typecheck/should_fail/T14904a.hs [new file with mode: 0644]
testsuite/tests/typecheck/should_fail/T14904a.stderr [new file with mode: 0644]
testsuite/tests/typecheck/should_fail/T14904b.hs [new file with mode: 0644]
testsuite/tests/typecheck/should_fail/T14904b.stderr [new file with mode: 0644]
testsuite/tests/typecheck/should_fail/all.T

diff --git a/testsuite/tests/typecheck/should_fail/T14904a.hs b/testsuite/tests/typecheck/should_fail/T14904a.hs
new file mode 100644 (file)
index 0000000..654f5a6
--- /dev/null
@@ -0,0 +1,9 @@
+{-# LANGUAGE RankNTypes #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeInType #-}
+module T14904a where
+
+import Data.Kind
+
+type family F (f :: forall a. g a) :: Type where
+  F (f :: forall a. g a) = Int
diff --git a/testsuite/tests/typecheck/should_fail/T14904a.stderr b/testsuite/tests/typecheck/should_fail/T14904a.stderr
new file mode 100644 (file)
index 0000000..94cad4a
--- /dev/null
@@ -0,0 +1,8 @@
+
+T14904a.hs:8:1: error:
+    You have written a *complete user-suppled kind signature*,
+    but the following variable is undetermined: k0 :: *
+    Perhaps add a kind signature.
+    Inferred kinds of user-written variables:
+      g :: k0 -> *
+      f :: forall (a :: k0). g a
diff --git a/testsuite/tests/typecheck/should_fail/T14904b.hs b/testsuite/tests/typecheck/should_fail/T14904b.hs
new file mode 100644 (file)
index 0000000..d8cfa1e
--- /dev/null
@@ -0,0 +1,9 @@
+{-# LANGUAGE RankNTypes #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE TypeInType #-}
+module T14904b where
+
+import Data.Kind
+
+type family F f :: Type where
+  F ((f :: forall a. g a) :: forall a. g a) = Int
diff --git a/testsuite/tests/typecheck/should_fail/T14904b.stderr b/testsuite/tests/typecheck/should_fail/T14904b.stderr
new file mode 100644 (file)
index 0000000..fff6942
--- /dev/null
@@ -0,0 +1,6 @@
+
+T14904b.hs:9:7: error:
+    • Expected kind ‘forall (a :: k1). g a’, but ‘f’ has kind ‘k0’
+    • In the first argument of ‘F’, namely
+        ‘((f :: forall a. g a) :: forall a. g a)’
+      In the type family declaration for ‘F’
index 16fd5de..a4150ea 100644 (file)
@@ -471,3 +471,5 @@ test('T14605', normal, compile_fail, [''])
 test('T14761a', normal, compile_fail, [''])
 test('T14761b', normal, compile_fail, [''])
 test('T14884', normal, compile_fail, [''])
+test('T14904a', normal, compile_fail, [''])
+test('T14904b', normal, compile_fail, [''])