summaryrefslogtreecommitdiff
path: root/testsuite/tests/polykinds
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2020-12-02 10:27:47 +0000
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-12-08 15:31:41 -0500
commit62ed6957463a9c0f711ea698d7ed4371e00fb122 (patch)
treeeb13107435b357117fda5e787ce4a70bd111a8f8 /testsuite/tests/polykinds
parent8fac4b9333ef3607e75b4520d847054316cb8c2d (diff)
downloadhaskell-62ed6957463a9c0f711ea698d7ed4371e00fb122.tar.gz
Fix kind inference for data types. Again.
This patch fixes several aspects of kind inference for data type declarations, especially data /instance/ declarations Specifically 1. In kcConDecls/kcConDecl make it clear that the tc_res_kind argument is only used in the H98 case; and in that case there is no result kind signature; and hence no need for the disgusting splitPiTys in kcConDecls (now thankfully gone). The GADT case is a bit different to before, and much nicer. This is what fixes #18891. See Note [kcConDecls: kind-checking data type decls] 2. Do not look at the constructor decls of a data/newtype instance in tcDataFamInstanceHeader. See GHC.Tc.TyCl.Instance Note [Kind inference for data family instances]. This was a new realisation that arose when doing (1) This causes a few knock-on effects in the tests suite, because we require more information than before in the instance /header/. New user-manual material about this in "Kind inference in data type declarations" and "Kind inference for data/newtype instance declarations". 3. Minor improvement in kcTyClDecl, combining GADT and H98 cases 4. Fix #14111 and #8707 by allowing the header of a data instance to affect kind inferece for the the data constructor signatures; as described at length in Note [GADT return types] in GHC.Tc.TyCl This led to a modest refactoring of the arguments (and argument order) of tcConDecl/tcConDecls. 5. Fix #19000 by inverting the sense of the test in new_locs in GHC.Tc.Solver.Canonical.canDecomposableTyConAppOK.
Diffstat (limited to 'testsuite/tests/polykinds')
-rw-r--r--testsuite/tests/polykinds/T13659.stderr8
-rw-r--r--testsuite/tests/polykinds/T16221a.stderr4
2 files changed, 6 insertions, 6 deletions
diff --git a/testsuite/tests/polykinds/T13659.stderr b/testsuite/tests/polykinds/T13659.stderr
index 84e81d04c0..dad726be5f 100644
--- a/testsuite/tests/polykinds/T13659.stderr
+++ b/testsuite/tests/polykinds/T13659.stderr
@@ -1,6 +1,6 @@
-T13659.hs:14:27: error:
- • Expected a type, but ‘a’ has kind ‘[*]’
- • In the first argument of ‘Format’, namely ‘'[Int, a]’
- In the type ‘Format '[Int, a]’
+T13659.hs:14:15: error:
+ • Expected kind ‘[*]’, but ‘a’ has kind ‘*’
+ • In the first argument of ‘Format’, namely ‘a’
+ In the type ‘Format a’
In the definition of data constructor ‘I’
diff --git a/testsuite/tests/polykinds/T16221a.stderr b/testsuite/tests/polykinds/T16221a.stderr
index 5aa099b0f1..5945369a6c 100644
--- a/testsuite/tests/polykinds/T16221a.stderr
+++ b/testsuite/tests/polykinds/T16221a.stderr
@@ -1,7 +1,7 @@
T16221a.hs:6:49: error:
- • Expected kind ‘k’, but ‘b’ has kind ‘k1’
- ‘k1’ is a rigid type variable bound by
+ • Expected kind ‘k’, but ‘b’ has kind ‘k2’
+ ‘k2’ is a rigid type variable bound by
an explicit forall k (b :: k)
at T16221a.hs:6:20
‘k’ is a rigid type variable bound by