summaryrefslogtreecommitdiff
path: root/testsuite/tests/dependent/should_fail
diff options
context:
space:
mode:
authorRyan Scott <ryan.gl.scott@gmail.com>2019-03-06 14:42:02 -0500
committerMarge Bot <ben+marge-bot@smart-cactus.org>2019-03-07 14:07:49 -0500
commit068b7e983f4a0b35f453aa5e609998efd0c3f334 (patch)
tree7a0372414b520722b1168fa9b5e15afcdb821caf /testsuite/tests/dependent/should_fail
parent7a68254a7284db5bf8f1fa82aba4a6825d8f050a (diff)
downloadhaskell-068b7e983f4a0b35f453aa5e609998efd0c3f334.tar.gz
Fix #16391 by using occCheckExpand in TcValidity
The type-variables-escaping-their-scope-via-kinds check in `TcValidity` was failing to properly expand type synonyms, which led to #16391. This is easily fixed by using `occCheckExpand` before performing the validity check. Along the way, I refactored this check out into its own function, and sprinkled references to Notes to better explain all of the moving parts. Many thanks to @simonpj for the suggestions. Bumps the haddock submodule.
Diffstat (limited to 'testsuite/tests/dependent/should_fail')
-rw-r--r--testsuite/tests/dependent/should_fail/T16391b.hs11
-rw-r--r--testsuite/tests/dependent/should_fail/T16391b.stderr6
-rw-r--r--testsuite/tests/dependent/should_fail/all.T1
3 files changed, 18 insertions, 0 deletions
diff --git a/testsuite/tests/dependent/should_fail/T16391b.hs b/testsuite/tests/dependent/should_fail/T16391b.hs
new file mode 100644
index 0000000000..f7049fb29d
--- /dev/null
+++ b/testsuite/tests/dependent/should_fail/T16391b.hs
@@ -0,0 +1,11 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE PolyKinds #-}
+{-# LANGUAGE TypeFamilies #-}
+module T16391b where
+
+import GHC.Exts
+
+type family T (r :: RuntimeRep) :: TYPE r
+
+foo :: T r
+foo = foo
diff --git a/testsuite/tests/dependent/should_fail/T16391b.stderr b/testsuite/tests/dependent/should_fail/T16391b.stderr
new file mode 100644
index 0000000000..35b5448917
--- /dev/null
+++ b/testsuite/tests/dependent/should_fail/T16391b.stderr
@@ -0,0 +1,6 @@
+
+T16391b.hs:10:8: error:
+ • Quantified type's kind mentions quantified type variable
+ type: ‘forall (r :: RuntimeRep). T r’
+ where the body of the forall has this kind: ‘TYPE r’
+ • In the type signature: foo :: T r
diff --git a/testsuite/tests/dependent/should_fail/all.T b/testsuite/tests/dependent/should_fail/all.T
index ca8a50addf..baaddd7442 100644
--- a/testsuite/tests/dependent/should_fail/all.T
+++ b/testsuite/tests/dependent/should_fail/all.T
@@ -52,3 +52,4 @@ test('T16326_Fail9', normal, compile_fail, [''])
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'])