summaryrefslogtreecommitdiff
path: root/testsuite/tests
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2021-03-13 23:46:50 +0000
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-03-31 11:12:52 -0400
commitdbadd672ba7da67533c34d8594ac7f91dde0f415 (patch)
tree4c40cc05d77aa270d754c4090ebcaa1fbe62d8f4 /testsuite/tests
parent44774dc591206291d06e6181f599151631062332 (diff)
downloadhaskell-dbadd672ba7da67533c34d8594ac7f91dde0f415.tar.gz
The result kind of a signature can't mention quantified vars
This patch fixes a small but egregious bug, which allowed a type signature like f :: forall a. blah not to fail if (blah :: a). Acutally this only showed up as a ASSERT error (#19495). The fix is very short, but took quite a bit of head scratching Hence the long Note [Escaping kind in type signatures] While I was in town, I also added a short-cut for the common case of having no quantifiers to tcImplicitTKBndrsX. Metric Decrease: T9198 Metric Increase: T9198
Diffstat (limited to 'testsuite/tests')
-rw-r--r--testsuite/tests/dependent/should_fail/T16391b.stderr7
-rw-r--r--testsuite/tests/dependent/should_fail/T19495.hs14
-rw-r--r--testsuite/tests/dependent/should_fail/all.T7
3 files changed, 25 insertions, 3 deletions
diff --git a/testsuite/tests/dependent/should_fail/T16391b.stderr b/testsuite/tests/dependent/should_fail/T16391b.stderr
index 35b5448917..2209886a89 100644
--- a/testsuite/tests/dependent/should_fail/T16391b.stderr
+++ b/testsuite/tests/dependent/should_fail/T16391b.stderr
@@ -1,6 +1,7 @@
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’
+ • Expected a type, but ‘T r’ has kind ‘TYPE r’
+ ‘r’ is a rigid type variable bound by
+ the type signature for ‘foo’
+ at T16391b.hs:10:1-10
• In the type signature: foo :: T r
diff --git a/testsuite/tests/dependent/should_fail/T19495.hs b/testsuite/tests/dependent/should_fail/T19495.hs
new file mode 100644
index 0000000000..e4586895ae
--- /dev/null
+++ b/testsuite/tests/dependent/should_fail/T19495.hs
@@ -0,0 +1,14 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE PolyKinds #-}
+{-# LANGUAGE TypeFamilies #-}
+
+module T19495 where
+-- This test is a copy of T16391b, but run with -ddump-tc-trace
+-- which (in #19495) triggered a panic
+
+import GHC.Exts
+
+type family T (r :: RuntimeRep) :: TYPE r
+
+foo :: T r
+foo = foo
diff --git a/testsuite/tests/dependent/should_fail/all.T b/testsuite/tests/dependent/should_fail/all.T
index e8705af1e5..a180223eb2 100644
--- a/testsuite/tests/dependent/should_fail/all.T
+++ b/testsuite/tests/dependent/should_fail/all.T
@@ -53,7 +53,14 @@ 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'])
+
+# T16391b got an ASSERT error during -ddump-tc-trace (#19495)
+# So we run it again with -ddump-tc-trace and a new name
+# Little changes in the trace output don't matter; just search for "panic!"
+test('T19495', [ grep_errmsg(r'panic!') ], compile_fail, ['-dsuppress-uniques -ddump-tc-trace'])
+
test('T16344', normal, compile_fail, [''])
test('T16344a', normal, compile_fail, [''])
test('T16418', normal, compile_fail, [''])