summaryrefslogtreecommitdiff
path: root/testsuite/tests/polykinds
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2020-06-13 00:23:16 +0100
committerSimon Peyton Jones <simonpj@microsoft.com>2020-07-03 08:37:42 +0100
commit4bf18646acbb5a59ad8716aedc32acfe2ead0f58 (patch)
tree7704e27c8aad62e8e6aabbc70c2c9815a3aacac8 /testsuite/tests/polykinds
parentedc8d22b2eea5d43dd6c3d0e4b2f85fc02ffa5ce (diff)
downloadhaskell-4bf18646acbb5a59ad8716aedc32acfe2ead0f58.tar.gz
Improve handling of data type return kindswip/T18300
Following a long conversation with Richard, this patch tidies up the handling of return kinds for data/newtype declarations (vanilla, family, and instance). I have substantially edited the Notes in TyCl, so they would bear careful reading. Fixes #18300, #18357 In GHC.Tc.Instance.Family.newFamInst we were checking some Lint-like properties with ASSSERT. Instead Richard and I have added a proper linter for axioms, and called it from lintGblEnv, which in turn is called in tcRnModuleTcRnM New tests (T18300, T18357) cause an ASSERT failure in HEAD.
Diffstat (limited to 'testsuite/tests/polykinds')
-rw-r--r--testsuite/tests/polykinds/T18300.hs16
-rw-r--r--testsuite/tests/polykinds/T18300.stderr4
-rw-r--r--testsuite/tests/polykinds/all.T1
3 files changed, 21 insertions, 0 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, [''])