[commit: ghc] ghc-8.0: Fix printing of "kind" vs. "type" (6247d27)

git at git.haskell.org git at git.haskell.org
Wed Mar 23 16:37:13 UTC 2016


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

On branch  : ghc-8.0
Link       : http://ghc.haskell.org/trac/ghc/changeset/6247d27fdaebd3a92647884ee1e86232fc9e54d1/ghc

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

commit 6247d27fdaebd3a92647884ee1e86232fc9e54d1
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
    
    (cherry picked from commit f602f4a6fbf40d1a3c3c02294e90fcb2d5866d04)


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

6247d27fdaebd3a92647884ee1e86232fc9e54d1
 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 a5612f8..522ae43 100644
--- a/testsuite/tests/polykinds/all.T
+++ b/testsuite/tests/polykinds/all.T
@@ -144,3 +144,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