[commit: ghc] master: Fix printing of "kind" vs. "type" (f602f4a)

git at git.haskell.org git at git.haskell.org
Wed Mar 16 01:17:28 UTC 2016


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/f602f4a6fbf40d1a3c3c02294e90fcb2d5866d04/ghc

>---------------------------------------------------------------

commit f602f4a6fbf40d1a3c3c02294e90fcb2d5866d04
Author: Richard Eisenberg <eir at cis.upenn.edu>
Date:   Tue Mar 15 14:54:48 2016 -0400

    Fix printing of "kind" vs. "type"
    
    This is as reported in #11471, though it's not the focus of that
    ticket.
    
    test case: polykinds/KindVType


>---------------------------------------------------------------

f602f4a6fbf40d1a3c3c02294e90fcb2d5866d04
 compiler/typecheck/TcUnify.hs              | 10 +---------
 testsuite/tests/polykinds/KindVType.hs     |  8 ++++++++
 testsuite/tests/polykinds/KindVType.stderr |  7 +++++++
 testsuite/tests/polykinds/all.T            |  1 +
 4 files changed, 17 insertions(+), 9 deletions(-)

diff --git a/compiler/typecheck/TcUnify.hs b/compiler/typecheck/TcUnify.hs
index affdd59..8eeef4e 100644
--- a/compiler/typecheck/TcUnify.hs
+++ b/compiler/typecheck/TcUnify.hs
@@ -1170,16 +1170,8 @@ uType origin t_or_k orig_ty1 orig_ty2
       -- See Note [Mismatched type lists and application decomposition]
       | tc1 == tc2, length tys1 == length tys2
       = ASSERT2( isGenerativeTyCon tc1 Nominal, ppr tc1 )
-        do { cos <- zipWith3M (uType origin) t_or_ks tys1 tys2
+        do { cos <- zipWithM (uType origin t_or_k) tys1 tys2
            ; return $ mkTyConAppCo Nominal tc1 cos }
-      where
-        bndrs      = tyConBinders tc1
-        t_or_ks    = case t_or_k of
-                       KindLevel -> repeat KindLevel
-                       TypeLevel -> map (\bndr -> if isNamedBinder bndr
-                                                  then KindLevel
-                                                  else TypeLevel) bndrs ++
-                                    repeat TypeLevel
 
     go (LitTy m) ty@(LitTy n)
       | m == n
diff --git a/testsuite/tests/polykinds/KindVType.hs b/testsuite/tests/polykinds/KindVType.hs
new file mode 100644
index 0000000..16815c8
--- /dev/null
+++ b/testsuite/tests/polykinds/KindVType.hs
@@ -0,0 +1,8 @@
+module KindVType where
+
+-- test printing of "type" in output, not "kind"
+
+import Data.Proxy
+
+foo :: Proxy Maybe
+foo = (Proxy :: Proxy Int)
diff --git a/testsuite/tests/polykinds/KindVType.stderr b/testsuite/tests/polykinds/KindVType.stderr
new file mode 100644
index 0000000..7ce3404
--- /dev/null
+++ b/testsuite/tests/polykinds/KindVType.stderr
@@ -0,0 +1,7 @@
+
+KindVType.hs:8:8: error:
+    • Couldn't match type ‘*’ with ‘* -> *’
+      Expected type: Proxy Maybe
+        Actual type: Proxy Int
+    • In the expression: (Proxy :: Proxy Int)
+      In an equation for ‘foo’: foo = (Proxy :: Proxy Int)
diff --git a/testsuite/tests/polykinds/all.T b/testsuite/tests/polykinds/all.T
index 45981e9..17d0211 100644
--- a/testsuite/tests/polykinds/all.T
+++ b/testsuite/tests/polykinds/all.T
@@ -145,3 +145,4 @@ test('T11399', normal, compile_fail, [''])
 test('T11611', normal, compile_fail, [''])
 test('T11648', normal, compile, [''])
 test('T11648b', normal, compile_fail, [''])
+test('KindVType', normal, compile_fail, [''])



More information about the ghc-commits mailing list