Fix printing of "kind" vs. "type"
authorRichard Eisenberg <eir@cis.upenn.edu>
Tue, 15 Mar 2016 18:54:48 +0000 (14:54 -0400)
committerRichard Eisenberg <eir@cis.upenn.edu>
Wed, 16 Mar 2016 01:19:20 +0000 (21:19 -0400)
This is as reported in #11471, though it's not the focus of that
ticket.

test case: polykinds/KindVType

compiler/typecheck/TcUnify.hs
testsuite/tests/polykinds/KindVType.hs [new file with mode: 0644]
testsuite/tests/polykinds/KindVType.stderr [new file with mode: 0644]
testsuite/tests/polykinds/all.T

index affdd59..8eeef4e 100644 (file)
@@ -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 (file)
index 0000000..16815c8
--- /dev/null
@@ -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 (file)
index 0000000..7ce3404
--- /dev/null
@@ -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)
index 45981e9..17d0211 100644 (file)
@@ -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, [''])