summaryrefslogtreecommitdiff
path: root/testsuite/tests/polykinds
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2018-10-03 16:35:09 +0100
committerSimon Peyton Jones <simonpj@microsoft.com>2018-10-04 15:37:58 +0100
commit2f09753f96207c12efd43090f5de55b05aef35d3 (patch)
tree4093c0be62785abc174e1ff2e1ea781cc07789b4 /testsuite/tests/polykinds
parent37ef7031b95c97e7c8bc1d14bc95554a3bac2873 (diff)
downloadhaskell-2f09753f96207c12efd43090f5de55b05aef35d3.tar.gz
Distinguish Inferred from Specified tyvars
In a declared type we need to distinguish between Inferred and Specified type variables. This was exposed by Trac #15592. See Note [Work out final tyConBinders] in TcTyClsDecls. I had to change the definition of HasField in GHC.Records to class HasField x r a | x r -> a where so as to have an /inferred/ kind argument rather than a specfied one. So HasField :: forall {k}. k -> * -> * -> Constraint
Diffstat (limited to 'testsuite/tests/polykinds')
-rw-r--r--testsuite/tests/polykinds/T15592.hs5
-rw-r--r--testsuite/tests/polykinds/T15592.stderr11
-rw-r--r--testsuite/tests/polykinds/all.T1
3 files changed, 17 insertions, 0 deletions
diff --git a/testsuite/tests/polykinds/T15592.hs b/testsuite/tests/polykinds/T15592.hs
new file mode 100644
index 0000000000..7e81c42565
--- /dev/null
+++ b/testsuite/tests/polykinds/T15592.hs
@@ -0,0 +1,5 @@
+{-# LANGUAGE TypeInType #-}
+{-# OPTIONS_GHC -ddump-types -fprint-explicit-foralls #-}
+module T15592 where
+
+data T f (a::k1) b = MkT (f a b) (T f a b)
diff --git a/testsuite/tests/polykinds/T15592.stderr b/testsuite/tests/polykinds/T15592.stderr
new file mode 100644
index 0000000000..71dc3b20b3
--- /dev/null
+++ b/testsuite/tests/polykinds/T15592.stderr
@@ -0,0 +1,11 @@
+TYPE SIGNATURES
+ T15592.MkT ::
+ forall {k} k1 (f :: k1 -> k -> *) (a :: k1) (b :: k).
+ f a b -> T f a b -> T f a b
+TYPE CONSTRUCTORS
+ type role T nominal nominal representational nominal nominal
+ T :: forall {k} k1. (k1 -> k -> *) -> k1 -> k -> *
+COERCION AXIOMS
+Dependent modules: []
+Dependent packages: [base-4.12.0.0, ghc-prim-0.5.3,
+ integer-gmp-1.0.2.0]
diff --git a/testsuite/tests/polykinds/all.T b/testsuite/tests/polykinds/all.T
index ae4ee51a21..010d0ac703 100644
--- a/testsuite/tests/polykinds/all.T
+++ b/testsuite/tests/polykinds/all.T
@@ -193,3 +193,4 @@ test('T15116a', normal, compile_fail, [''])
test('T15170', normal, compile, [''])
test('T14939', normal, compile, ['-O'])
test('T15577', normal, compile_fail, ['-O'])
+test('T15592', normal, compile, [''])